Capture an invoice

Use the capture() function to capture payment on an invoice. This returns a Transaction object if it is successful or reports an error if the request cannot be handled. See the guide page about capturing a payment for examples and for more detail about how capturing fits into the payment flow.

Note that when capture() returns the Transaction object, this does not necessarily mean that the payment has succeeded immediately. You should check the status field of the object for completed status to confirm the payment. We recommend that you use webhooks to receive updates about the status of the transaction because it can change even after the capture() call has returned.

You must provide a payment source for the capture (Card, Token, or gateway request) unless it has been Authorizing an invoice previously. You can also pass an options object as a second parameter to enable extra features on Payment Service Providers (PSPs) that support them. The options include:

  • capture_amount: Some PSPs support partial captures, where the amount you eventually capture is less than the amount you originally specified in the invoice. Use capture_amount to choose the amount for a partial capture, if your PSPs provide this feature. For PSPs that do not support partial captures, you can get the same effect by capturing the full amount and then issuing a partial refund later.
  • capture_statement_descriptor: When you create an invoice, you can supply a statement descriptor, which is the text that will appear on the customer's bank statement for the payment. Some PSPs let you change the statement descriptor during capture. Set capture_statement_descriptor to the new text you want to use for the descriptor or omit this option to use the original descriptor from the invoice.
  • invoice_detail_ids: When you create an invoice, you can supply a set of invoice details to represent separate items being purchased (which might be items in a shopping cart, say). Some PSPs let you restrict the purchase to just a subset of these items during capture. Set invoice_detail_ids with an array that contains the id values of the InvoiceDetail objects that you want to include. If you omit this option (or the PSP does not support it) then the full list from the details field of the invoice will be used.
  • capture_type: Values: final or non-final. Default: non-final.
    When you do a partial capture, use this to say whether it’s the last capture for that authorization. With non-final, the rest of the authorization stays available for more partial captures; with "final", we capture the amount you send and release any remaining authorized funds so you don’t need a separate void. Final-capture behavior is supported for a handful of gateways; contact your ProcessOut account manager to confirm availability for your setup.

Note that if you do authorize the payment before capture then you can simply call the capture() function without any parameters.

Path Params
string
required

The invoice ID generated by ProcessOut during the invoice creation

Body Params
string

Source used to capture the payment. Can be a card, a token or a gateway request.

invoice_detail_ids
array of strings

Array of invoice details created with the invoice to capture.
Only supported on compatible payment providers

invoice_detail_ids
string

Amount to capture partially the transaction

string

Some payment providers are supporting different statement descriptor for the capture. Use this field to send a different one. By default, the one sent during the authorization will be forwarded.

string

Override the scheme ID

split_allocations
array of objects

An array of allocation objects that defines how the capture payment should be divided among different recipients. Each object in this array represents one "split" of the total invoice amount. This object will override the invoice's default split allocations.

split_allocations
string

Whether this partial capture is "final" or "non-final".

Headers
string

Unique key to your request that will be used for idempotency

Responses

Language
Credentials
Basic
base64
:
LoadingLoading…
Response
Choose an example:
application/json