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.
GuidesAPI Reference
GuidesAPI Reference
  • Reference
    • Introduction
      • POSTCreate Checkout
      • GETGet Checkout
LogoLogo
ReferenceCheckouts

Create Checkout

POST
/v2/checkouts
POST
/v2/checkouts
$curl -X POST https://global-api-sandbox.afterpay.com/v2/checkouts \
> -H "User-Agent: User-Agent" \
> -H "Content-Type: application/json" \
> -u "<username>:<password>" \
> -d '{
> "amount": {
> "amount": "100.00",
> "currency": "AUD"
> },
> "consumer": {
> "email": "test@example.com"
> }
>}'
1{
2 "token": "002.ejh49ovam0acussgg4c6slpqqtn1ntqt3m4efqdh4qe0u8qk",
3 "expires": "2023-08-29T00:57:25.754Z",
4 "redirectCheckoutUrl": "https://portal.sandbox.afterpay.com/us/checkout/?token=002.ejh49ovam0acussgg4c6slpqqtn1ntqt3m4efqdh4qe0u8qk"
5}

The checkouts endpoint is responsible for creating a new checkout and returning the associated checkout token.

Was this page helpful?
Previous

Get Checkout

Next
Built with

Authentication

AuthorizationBasic

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

Headers

User-AgentstringRequired
AcceptstringOptionalDefaults to application/json

Request

amountobjectRequired
Object containing amount and currency
consumerobjectRequired

The consumer data model is used for gathering essential user information. It captures details such as the individual’s first name, represented by givenNames, and their last name, captured under surname. In addition, it stores the user’s contact number under phoneNumber and their email address under email. These fields collectively provide contact and identification details for a user.

merchantReferencestringOptional
billingobjectOptional

This data model is used for storing an individual’s contact information. Mandatory fields such as name, line1, area1, region, postcode, and countryCode help in capturing vital information about a user’s location.

The line2 and area2 fields provide additional space for extended addresses, while phoneNumber can be used to store the user’s contact number.

The area1, area2 and region properties feature localized terminology based on country. Refer to the property descriptions for insights on each country’s specific usage

shippingobjectOptional

This data model is used for storing an individual’s contact information. Mandatory fields such as name, line1, area1, region, postcode, and countryCode help in capturing vital information about a user’s location.

The line2 and area2 fields provide additional space for extended addresses, while phoneNumber can be used to store the user’s contact number.

The area1, area2 and region properties feature localized terminology based on country. Refer to the property descriptions for insights on each country’s specific usage

merchantobjectOptional
itemslist of objectsOptional
courierobjectOptional

Essential information for tracking a shipment. The shippedAt key represents the date and time when the item was shipped. This value follows the ISO 8601 standard format for date and time representations.

The name field indicates the courier service employed to handle the shipment (e.g. FEDEX, UPS). For orders that are picked up in-store (also known as Buy-Online-Pickup-Instore), please use “INSTORE_PICKUP” as the name field value.

The tracking key represents a unique tracking number provided by the courier service to monitor the shipment’s progress. It’s a valuable tool for customers and businesses to track and trace their packages.

The priority field tracks the shipping speed or service level associated with the delivery.

taxAmountobjectOptional
Object containing amount and currency
shippingAmountobjectOptional
Object containing amount and currency
discountslist of objectsOptional
modestringOptionalDefaults to standard

Must be set to express to enable express checkout. Allowed values: express standard

descriptionstringOptionalDeprecated

Response

Returns a token, expiry date/time, and checkout URL if successful.

tokenstring
Checkout token to be used to complete payment.
expiresstring
The UTC timestamp of when the checkout token will expire, in ISO 8601 format.
redirectCheckoutUrlstring
A URL that can be used to redirect the customer to the Afterpay screenflow directly from the merchant backend.

Errors

400
Bad Request Error
422
Unprocessable Entity Error