Skip to main content
POST
Create a checkout session

Authorizations

X-API-Key
string
header
required

Company API key. Send in the X-API-Key header.

Headers

x-client-id
string
required

Client identifier for the company in the request.

Example:

"client_abc123"

Body

application/json
amount
integer
required

Amount in cents

Example:

15000

currency
enum<string>
required
Available options:
BRL,
USD
Example:

"BRL"

merchant_order_id
string
required
Example:

"ORD-123"

payment_method
enum<string> | null

Restrict to a specific method. Omit to allow both.

Available options:
card,
pix
Example:

"card"

gateway_first_try
enum<string> | null

Gateway slug to attempt first. Falls back to routing rules if not set or if the gateway is not enabled for this company.

Available options:
pagarme,
picpay,
safe2pay,
pagbank,
stripe,
asaas,
erede
Example:

"pagarme"

expires_in
integer

Lifetime in seconds (60–86400). Default: 1800.

Example:

1800

metadata
object | null

Arbitrary data forwarded to your frontend.

success_url
string<uri> | null

Frontend redirect after successful payment.

Example:

"https://mystore.com/order/success"

cancel_url
string<uri> | null

Frontend redirect after failed or cancelled payment.

Example:

"https://mystore.com/order/failed"

customer
object | null

Customer identification to load saved cards. Provide token, email, or document — checked in that priority order.

Response

Checkout session created

token
string

Single-use session token to pass to your frontend.

Example:

"cs_live_a1b2c3d4e5f6..."

amount
integer

Amount in cents — immutable once session is created.

Example:

15000

currency
string
Example:

"BRL"

merchant_order_id
string
Example:

"ORD-123"

payment_method
enum<string> | null
Available options:
card,
pix
Example:

"card"

gateway_first_try
string | null
Example:

"pagarme"

metadata
object | null
success_url
string<uri> | null
Example:

"https://mystore.com/order/success"

cancel_url
string<uri> | null
Example:

"https://mystore.com/order/failed"

expires_at
string<date-time>

ISO 8601 UTC timestamp when the session expires.

Example:

"2026-06-23T14:30:00+00:00"

saved_cards
object[]

Active saved cards for the identified customer. Empty array when no customer was identified or no cards exist.