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.Endpoints
| Method | Route | What it does | Rate-limit |
|---|---|---|---|
GET | /public/checkout/{id} | Fetches the public config to render the page | 60 req/min/IP |
POST | /public/checkout/{id}/opened | Marks the Session as “opened by the buyer” | 60 req/min/IP |
POST | /public/checkout/{id}/confirm | Confirms the payment (tokenId + buyer data) | 10 req/min/IP |
The
{id} can be a Session (cs_*), a Link (chk_*), or a slug. When given a Link or slug, the
endpoint materializes a new Session and returns it.Get public config
cs_*) or Link
(chk_*). When given a Link, it materializes a new Session and returns it.
Only when
{id} is a Link (chk_*). The client sends a candidate ID (cs_[a-f0-9]{48}, locally
generated with 192 bits of entropy) so the Session is materialized idempotently — a refresh with the
same sessionId reuses the existing Session. For a direct cs_*, this parameter is ignored.200):
The returned Session is a masked public view — it does not include
metadata, tenantId, or
transactionId. Only what is needed to render the page is exposed.200 · 404 (invalid or expired ID).
Mark as opened
created → opened only on the first call. Fires the
checkout.session.opened event.
Required only when
{id} is a Link (chk_*). Same sessionId as the GET; allows the Session to be
materialized idempotently.200):
Confirm payment
cs_*)
or Link (chk_*). Idempotent via the Idempotency-Key header: repeated requests return the
original response, and a concurrent call waits for the first one to finish — the primary defense
against double charges.
Body
Payment entries (1–8). 1 entry = single-method flow; 2+ entries = combined payment
(requires
paymentMethods.combined.enabled on the Session). The sum of all amount values must match
exactly session.amount.Full buyer details. Must satisfy the Session’s
requiredFields (email, document, and
phone are always required; address if listed). See
Customer.Values for the Session’s
customFields. Keys match customFields[].key; values are strings
("true"/"false" for checkboxes); each value ≤ 2000 chars.payments entry is discriminated by paymentMethod:
Card
Card
tokenId is required; holderName is optional; installments from 1 to 12. Tokenize the card via
the Tokenizer before calling confirm.PIX
PIX
Boleto
Boleto
Full example
200):
- For PIX,
pixUrlcontains the BR-Code payload for the banking app;expiresAtindicates the expiration. - For boleto,
boletoUrl/boletoDigitableLine/boletoBarcodecarry the boleto data. - If declined,
session.statusreverts toopened(retry allowed) andpayments[].errorMessage/declineCodeexplain the reason.
200 (payment result, success or decline) · 409 (Session in an
invalid state — already paid, expired, or cancelled — or parent Link archived → link_not_active).
Buyer lifecycle (summary)
Opens the URL
The buyer accesses
https://pay.sandbox.z2pay.com/c/{id}. The page calls
GET /public/checkout/{id} to load the config.Page marks as opened
The page calls
POST /public/checkout/{id}/opened — the Session transitions from created → opened
and fires checkout.session.opened.Buyer confirms
When the buyer clicks “Pay”, the page tokenizes the card (if applicable) and calls
POST /public/checkout/{id}/confirm. The Session passes through paying and ends in paid (or
reverts to opened if declined).See also
Checkout Sessions
Session states and the Customer object.
Checkout Overview
Concepts and endpoint map.
Tokenizer
How to generate the card
tokenId before calling confirm.Test Cards
Approval and decline scenarios in the sandbox.
Webhooks
Events fired throughout the buyer lifecycle.
Errors
Domain error codes from confirm (
amount_mismatch, combined_disabled, etc.).
