cs_) is a concrete purchase instance. Unlike a
Link (template), it has a frozen amount and a state that progresses
as the buyer interacts. The id is 48 hex chars (192 bits of entropy), safe to expose in
a URL.
The examples use the sandbox: API at
https://checkout-api.sandbox.z2pay.com and page at
https://pay.sandbox.z2pay.com. In production, use https://checkout-api.z2pay.com and
https://pay.z2pay.com. Seller requests use the x-api-key header — see
Authentication.Endpoints
| Method | Route | Description |
|---|---|---|
POST | /checkout/sessions | Creates a Session (from a Link or ad-hoc) |
GET | /checkout/sessions | Lists Sessions (paginated) |
GET | /checkout/sessions/{id} | Fetches a Session by ID |
Immutable snapshot
When creating a Session from a Link, all data (items, price, splits, branding, methods) is copied into the Session. Editing the Link afterwards does not affect Sessions already created. This ensures that what the buyer saw at the time of payment is exactly what they pay.Create Session
linkId field. Returns 201. Supports
idempotency via the Idempotency-Key header (see Conventions).
Form A — from a Link
Form A — from a Link
Materializes the Session by copying the Link’s snapshot.
ID of the CheckoutLink (
chk_*). The presence of this field discriminates the body as “from a
Link”.Metadata specific to this Session (overrides the Link’s metadata).
Form B — ad-hoc (without a Link)
Form B — ad-hoc (without a Link)
Full body with inline config. Equivalent to the create Link body, with minor differences:
no
name/slug, with customer (pre-fills the buyer) and with description
(displayed on the page).The config fields (items, paymentMethods, branding, splits, requiredFields, customFields,
successUrl, cancelUrl, expirationMinutes) follow exactly the same schema as the
Checkout Link.
201):
In ad-hoc Sessions,
linkId is null. The returned url is ready to deliver to the buyer.Common errors
| HTTP | Code | When |
|---|---|---|
400 | validation_failed | Invalid body |
404 | not_found | linkId does not exist or has been archived |
409 | link_not_active | Link exists but is archived |
Customer object
Full name (≤ 255 chars).
Email address (≤ 255 chars). Always required on confirm — see required fields.
CPF, CNPJ, or passport (6–30 chars; digits only for CPF/CNPJ).
"cpf", "cnpj", or "passport".Phone number (≤ 30 chars). E.164 recommended:
+5511999999999.Address (
zipCode, street, number, complement, neighborhood, city, state, country
default "BR"). Opt-in: only required if "address" is present in requiredFields.List Sessions
Filter by status (CSV). E.g.:
?status=paid,opened. Values: created, opened, paying,
partially_paid, paid, failed, expired, canceled.Filter Sessions from a specific Link.
Search by Session ID or buyer name/email/document.
Page number (≥ 1).
Items per page (1–100).
200): paginated object { data, total, page, limit }.
Fetch Session by ID
tenantId, metadata, transactionId).
200 (found) · 404 (not found).
States and transitions
Valid transitions table
| From | To |
|---|---|
created | opened, expired, canceled |
opened | paying, expired, canceled |
paying | paid, partially_paid, failed, expired |
partially_paid | paid, failed |
failed | opened (retry), expired, canceled |
paid | — (terminal) |
expired | — (terminal) |
canceled | — (terminal) |
Meaning of each state
| State | Meaning |
|---|---|
created | Session created (via API); the buyer has not yet opened the page |
opened | Buyer opened the payment page |
paying | Buyer clicked “Pay”; transaction being processed by the gateway |
partially_paid | Combined payment: at least one payment confirmed, but the aggregate does not yet match session.amount (e.g., PIX paid, card pending) |
paid | Payment confirmed. Webhook checkout.session.payment_succeeded fired |
failed | Payment declined. The Session automatically returns to opened to allow a retry |
expired | expiresAt reached without confirmation |
canceled | Manual cancellation (via POST /charges/{id}/cancel or dashboard) |
partially_paid is exclusive to the combined payment flow. In single-method payments, the Session goes directly from
paying to paid or failed.Reconciliation
Every Session has atransactionId (populated after entering paying) that links the Session to the
payment record in the PSP. Use transactionId to fetch processing details (gateway,
NSU, authorization code, etc.) from the transactions API, if needed for financial reconciliation.
See also
Checkout Overview
Concepts, use cases, and endpoint map.
Checkout Links
Reusable templates and full config schema.
Charges (quick sale)
Ad-hoc Sessions with separate listing and cancellation.
Buyer (public page)
How the Session progresses from
created to paid.Webhooks
Session state change events.
Errors
Error format and checkout domain codes.

