Authenticate with Afterpay's API using HTTP Basic Auth with Merchant ID and Secret Key from the Afterpay merchant portal; endpoint is api.afterpay.com (global) or region-specific subdomains
POST /v2/checkouts with consumer (email, givenNames, surname), billing and shipping details, and items array including name, quantity, price.amount and price.currency; also include amount (total) and merchant.redirectConfirmUrl and merchant.redirectCancelUrl
The response contains a token and a redirectCheckoutUrl; redirect the customer to the redirectCheckoutUrl to complete the Afterpay installment agreement
On redirect return to redirectConfirmUrl with orderToken in query params, call POST /v2/payments/capture with token to finalize payment; the response includes payment id and status=APPROVED
Store the Afterpay payment id for refund and order management; initiate refunds via POST /v2/payments/<orderId>/refund with amount
Known gotchas
The checkout token expires after a short period; if the customer takes too long in the Afterpay flow, the token may expire and you must create a new checkout session
Afterpay's API versioning (v1 vs v2) differs by region; the AU/NZ legacy endpoint uses v1 while global v2 is the standard for most integrations; check the merchant portal for your region's endpoint
Payment status=APPROVED does not mean funds are instantly settled to your account; settlement follows Afterpay's standard payout schedule which varies by region
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp