Capture Payment

This endpoint performs a direct payment capture and is the equivalent of capturing a credit card. This operation is [idempotent](../../docs/online-api/idempotent-requests.md) based on the token, which allows for the safe retry of requests, guaranteeing the payment operation is only performed once. **Note**: Since the idempotency of this endpoint is based on the `token`, the inclusion of a `requestId` is not required. ### Connection Timeouts | Timeout | Time (Seconds) | | ------- | ------------ | | Open | 10 | | Read | 70 |

Authentication

AuthorizationBasic

Basic authentication of the form Basic <username:password>.

Path Parameters

environmentstringRequired

Use api-sandbox for AU/NZ, or api.us-sandbox for US.

Headers

User-AgentstringRequired
AcceptstringOptionalDefaults to application/json

Request

This endpoint expects an object.
tokenstringRequired
The token returned in the Create Order request.
merchantReferencestringOptional

The merchant’s order id/reference that this payment corresponds to. This will update any value previously provided in the Create Order request.

Response

If payment is approved by Afterpay, returns a Payment object in response. The Payment object is only returned if the payment is approved by Afterpay and successfully captured. If the payment is declined or fails, an error object is returned. See the Errors section.

Errors