Checkout link and customer redirection

Make the Checkout link available and configure the redirect

After creating the Checkout, use the returned id to build the URL that the payer will access.

Also configure the callback URLs to define where the payer will be directed after completing, canceling, or letting the Checkout expire.

How it works

%%{init: {"flowchart": {"nodeSpacing": 28,"rankSpacing": 32,"diagramPadding": 8,"padding": 10}}}%%
flowchart TD
  A["Create the Checkout"] --> B["Receive the ID"]
  B --> C["Build the URL"]
  C --> D["Redirect the payer"]
  D --> E["Payer completes the journey"]
  E --> F["Execute the callback"]
  F --> G["Receive the Webhook"]

  classDef inicio fill:#DBEAFE,stroke:#2563EB,color:#1E3A8A,stroke-width:3px,font-size:17px
  classDef validacao fill:#E0F2FE,stroke:#0284C7,color:#0C4A6E,stroke-width:2px,font-size:17px
  classDef sucesso fill:#DCFCE7,stroke:#16A34A,color:#14532D,stroke-width:3px,font-size:17px

  class A inicio
  class B,C,D,E,F validacao
  class G sucesso

  linkStyle default stroke:#94A3B8,stroke-width:2px

1. Store the Checkout ID

A successful creation returns the Checkout identifier:

{
  "id": "c7b1c696-b27b-4d3d-80b9-d1c018e387f8"
}

Store this id along with the corresponding order in your application.

2. Build the URL

Replace RETURNED_ID with the identifier received:

https://asaas.com/checkoutSession/show?id=RETURNED_ID

Example:

https://asaas.com/checkoutSession/show?id=c7b1c696-b27b-4d3d-80b9-d1c018e387f8

Redirect the payer to this URL or share the link through the channel used in your journey.

Checkout screen displayed to the customer

The page will be displayed according to the settings sent when creating the Checkout.

3. Configure the redirect

Provide the return URLs in the callback object when creating the Checkout:

{
  "callback": {
    "successUrl": "https://mysite.com/success",
    "cancelUrl": "https://mysite.com/canceled",
    "expiredUrl": "https://mysite.com/expired"
  }
}
FieldRedirect
successUrlJourney completed
cancelUrlJourney canceled
expiredUrlCheckout expired
⚠️

Attention

The callback controls the browser redirect.

Do not use successUrl as financial confirmation. Track the Checkout result via Webhook.

See the Events for Checkout.

Customer data

If customerData is sent at creation, the corresponding data will be displayed pre-filled in the Checkout.

Checkout screen with customer data automatically filled in

Configuring the payer's data is detailed in How to provide customer data.

Next steps


Did this page help you?