Prerequisites
Before creating a PIX payment:- Country must be
BR, currency must beBRL. - The customer must have a valid Brazilian tax ID: CPF (individuals, 11 digits) or CNPJ (businesses, 14 digits).
- A PIX provider must be configured and enabled in Dashboard > Connections.
Payment flow
Create (or retrieve) a customer with document
The customer object must include the Brazilian tax ID. You can create a customer ahead of time or include the
customer_payer inline in the payment request.Create the PIX payment (backend)
Pass A successful response returns
payment_method.type = "PIX" along with the customer document. The checkout_session links the payment to the SDK session.status: "PENDING" — PIX is asynchronous.Display the QR code to the customer
The payment response contains the PIX QR code in
payment_method.detail:- If
qr_codeis a base64 string, render it as an<img src="data:image/png;base64,...">. - If
qr_codeis a PIX copy-paste string (EMV format), display it alongside a QR code generated on the frontend. - Always show the expiry countdown to prompt the customer to pay before it lapses.
PIX expiry
PIX transactions expire if the customer does not pay within the window set during payment creation (default: 30 minutes in most providers, minimum: 15 minutes). Once expired, the payment status transitions toEXPIRED and cannot be reused — create a new payment.
To set a custom expiry, pass payment_method.expiration_date in the payment request (ISO 8601 format). Check your provider’s configuration in the Yuno Dashboard for supported ranges.
Confirming completion via webhook
PIX completion is asynchronous. When the customer pays, the Brazilian banking network notifies Yuno, which fires aPAYMENT_STATE_CHANGED webhook event.
Configure webhooks in Dashboard > Developers > Webhooks and handle the event in your backend:
Sandbox behavior
In the Yuno sandbox environment, all PIX payments automatically transition to
SUCCEEDED a few seconds after creation. No real QR scan is required. This lets you test your webhook handling and status updates end-to-end without a real bank account.Document type reference
| Document type | Who | Format | Digits |
|---|---|---|---|
CPF | Individual (Pessoa Física) | 11 numeric digits, no formatting | 12345678901 |
CNPJ | Business (Pessoa Jurídica) | 14 numeric digits, no formatting | 12345678000195 |