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.
HomeGuides
HomeGuides
  • About Afterpay
    • What Is Afterpay?
    • How Does Afterpay Work?
  • Afterpay Button
      • Overview
      • Sandbox Environment
      • Add The Button
      • Process the Credit Card
      • Order Management
      • Launch
      • Changing the Appearance
    • Afterpay Messaging
  • Express Checkout
    • Express Checkout Overview
    • Adding the Afterpay Express Checkout Button
    • Process The Credit Card
    • Complete the Express Checkout Process
    • Integrated Shipping
    • Checkout Widget
  • Cash App Pay
    • Using the Cash App Pay Button
    • Getting Started
    • Advanced Rendering Control
    • Mobile Redirection
    • Customer On-File Payments
LogoLogo
On this page
  • Update The Merchant Reference
  • Response
  • Error Codes
Afterpay ButtonGetting Started

Order Management

Was this page helpful?
Previous

Launch

Next
Built with

This section describes how to update an Afterpay order.


Update The Merchant Reference

If you do not have an order number (merchantReference), at the time of launching the Afterpay Button, you will use the below endpoint when the order is completed.

Using the authToken and token received from the onComplete function, make a PUT request containing the new merchantReference

This call can be made from the front-end or from a back-end service. If you are in the US or Canada, use the following URL:

1https://api-plus.us-sandbox.afterpay.com/v3/button
1https://api-plus.us.afterpay.com/v3/button

If you are in Australia use the following URL:

1https://api-plus.au-sandbox.afterpay.com/v3/button
1https://api-plus.au.afterpay.com/v3/button

If you are in the UK use the following URL:

1https://api-plus.eu-sandbox.afterpay.com/v3/button
1https://api-plus.eu.afterpay.com/v3/button

Response

1{
2 "authToken": "cbce234de1fbca534568904dd31..",
3 "token": "001.12321312312321",
4 "merchantReference": "newMerchantReference"
5}
authToken valid for 3 hours

This call must be made within 3 hours (180 minutes) of the customer completing the Afterpay, Clearpay (UK) or Cash App Afterpay (US) checkout flow.

Error Codes

errorCodehttpStatusCodeDescription
invalid_object422One or more required fields were missing or invalid
auth_token_malformed412The auth_token was invalid
too_many_requests429The customer has been rate limited
Unauthorized401The authToken has expired
Note

The information on this page also applies to Cash App Afterpay (US) and Clearpay (UK).