For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HomeGuidesAPI Reference
HomeGuidesAPI Reference
  • Online API
    • API Environments
    • Direct Payment Flow
    • REST
    • HTTPS
    • Dates
    • Pagination
    • Authentication
    • Idempotent Requests
    • Timeouts
    • API Simulator
  • Models
    • Introduction
    • Contact Object
    • Consumer Object
    • Discount Object
    • Item Object
    • Money Object
    • Order Details Object
    • Payment Object
    • Refund Object
    • Shipping Courier Object
  • Service Status
    • GETPing
  • Configuration
    • GETGet Configuration
  • Orders
    • Introduction
    • GETGet Order
    • POSTCreate Order
  • Javascript afterpay.js
    • Information
    • Redirect Method
  • Payments
    • Introduction
    • POSTCapture Payment
    • PUTUpdate Shipping Courier
    • GETGet Payment By Order ID
    • GETGet Payment By Token
    • GETList Payment(s)
    • POSTCreate Refund
    • PUTUpdate Payment by Order ID
    • POSTReverse Payment By Token
  • Errors
    • Introduction
    • Get Errors
    • Put/Post Errors
  • Reference
      • POSTCapture Payment
      • POSTCreate Refund
      • GETGet Payment By Order ID
      • GETGet Payment By Token
      • GETList Payments
      • POSTReverse Payment
      • PUTUpdate Courier
      • PUTUpdate Payment
LogoLogo
ReferencePayments

Capture Payment

POST
https://global-api-sandbox.afterpay.com/v1/payments/capture/environment::environment
POST
/v1/payments/capture/environment::environment
$curl -X POST https://global-api-sandbox.afterpay.com/v1/payments/capture/environment:environment \
> -H "User-Agent: User-Agent" \
> -H "Content-Type: application/json" \
> -u "<username>:<password>" \
> -d '{
> "token": "string"
>}'
1{}
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 |
Was this page helpful?
Previous

Create Refund

Next
Built with

This endpoint performs a direct payment capture and is the equivalent of capturing a credit card. This operation is idempotent 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

TimeoutTime (Seconds)
Open10
Read70

Authentication

AuthorizationBasic

Basic authentication of the form Basic <base64(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

402
Payment Required Error
412
Precondition Failed Error