Pix payment
Generates the Pix payment instructions for an existing order: QR Code (base64 image) and EMV code (copy-and-paste).
Show an expiration countdown
On the success page, show the QR Code, the copy-and-paste code, and a
countdown with the time remaining until pix_expiration_date. Calculate
the countdown dynamically from that field — don't hardcode an
expiration time in your code, since this value can vary.
Custom expiration
By default, the Pix expiration comes from the store's configuration. To
set an expiration per transaction, send
payment_data.pix.expiration_date in the Y-m-d H:i:s format, in
Brasília time (America/Sao_Paulo) and with a future date.
The field is optional: if it isn't sent, the expiration still comes from the store's configuration, with no change in behavior.
Testing in the sandbox
In the sandbox, Pix is automatically approved about 5 seconds
after it is generated. The scenario depends on the document_number:
document_number |
Result in the sandbox |
|---|---|
Any valid CPF or CNPJ (e.g., 19100000000) |
Approved in ~5 s and then integrated |
CPF 40827365144 or CNPJ 40827365000109 |
Stays pending (the payment is not confirmed) |
Both scenarios are ready in the Request Body, in the Sandbox: approved and Sandbox: pending tabs. Webhooks received in each one: Test Pix and boleto in the sandbox.
Authorizations
Bearer token of the merchant obtained via POST /oauth2/token using the
merchant's credentials (not the app's). See
Authentication.
Request Body
Responses
Pix instructions returned. The pix_qrcode (base64 PNG, without
the data: prefix), pix_emv (BR Code, copy-and-paste), and
pix_expiration_date (Pix expiration date/time, Y-m-d H:i:s
format) fields live in data.payment. Show the QR Code and the
copy-and-paste code to the customer.