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

Reverse Payment

POST
https://global-api-sandbox.afterpay.com/v1/payments/token::token/reversal/environment::environment
POST
/v1/payments/token::token/reversal/environment::environment
$curl -X POST https://global-api-sandbox.afterpay.com/v1/payments/token:token/reversal/environment:api-sandbox \
> -H "User-Agent: User-Agent" \
> -u "<username>:<password>"
1{}
This endpoint performs a reversal of the checkout that is used to initiate the Afterpay payment process. This will cancel the order asynchronously as soon as it is created without the need of an additional call to the void endpoint. In order for a payment to be eligible, the order must be in a Captured state and must be issued within 10 minutes of the order being created. If this is called after a timeout is received from [`v1/payments/capture`](Capture-Payment.v1.yaml/paths/~1v1~1payments~1capture/post), and `v1/payments/capture` eventually completes successfully, the order will end up in a `REVERSED` state. This is similar to a call to the [`v1/payments/refund`](Create-Refund.v1.yaml/paths/~1v1~1payments~1{orderId}~1refund) endpoint except that merchant fees are not paid to Afterpay and the capture and refund will not show up in the settlement file. ### Connection Timeouts | Timeout | Time (Seconds) | | ------- | ------------ | | Open | 10 | | Read | 70 |
Was this page helpful?
Previous

Update Courier

Next
Built with

This endpoint performs a reversal of the checkout that is used to initiate the Afterpay payment process. This will cancel the order asynchronously as soon as it is created without the need of an additional call to the void endpoint. In order for a payment to be eligible, the order must be in a Captured state and must be issued within 10 minutes of the order being created.

If this is called after a timeout is received from v1/payments/capture, and v1/payments/capture eventually completes successfully, the order will end up in a REVERSED state. This is similar to a call to the v1/payments/refund endpoint except that merchant fees are not paid to Afterpay and the capture and refund will not show up in the settlement file.

Connection Timeouts

TimeoutTime (Seconds)
Open10
Read70

Authentication

AuthorizationBasic

Basic authentication of the form Basic <base64(username:password)>.

Path parameters

environmentstringRequiredDefaults to api-sandbox

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

tokenstringRequired
Order token that was used to complete payment.

Headers

User-AgentstringRequired
AcceptstringOptionalDefaults to application/json

Response

The Reversal endpoint indicates a successful response with a 204 status code response. Returns no content in the response.

Errors

402
Payment Required Error
412
Precondition Failed Error