The flow
1
Generate an idempotencyKey for the invoice
Tie it to the business intent — typically the invoice or order id, prefixed so it is unambiguous.Persist it locally before calling the API. On any network failure during the next step, you will retry with the same key.
2
Create the payment order
201 Created with status: "PENDING" and the provider-rendered QR.qrcode and copypaste are the same EMV payload. Store the id for reconciliation; persist the QR/copypaste alongside the invoice.3
Render the QR to the customer
Two surfaces:
qrcode— generate a QR image on your client side and display it.copypaste— show as a copy-able string for users on the same device as their banking app (“PIX copia e cola”).
expiresAt so they know how long the QR is valid.4
Wait for settlement — via webhook
Configure a webhook endpoint and subscribe to Verify the signature (see Verifying signatures), then mark the invoice as paid and ship.
payment_order.success. When the customer pays:5
(Fallback) Poll if you cannot expose a webhook
If a webhook endpoint is not feasible, poll the order until it reaches a final state.Poll every 5–10 seconds until
status is one of SUCCESS, FAILED, EXPIRED, REFUNDED. Then stop.Polling consumes rate-limit quota — prefer webhooks.Listing inbound orders
To page through historical inbound orders, use the list endpoint with a direction filter:Static QR (long-lived)
For a reusable QR — e.g., a store-counter sign that any customer can pay — usePIX_CASH_IN_EMV_STATIC:
payment_order.success event on a new logical order. The platform manages this — your webhook consumer processes each event independently, deduplicating by messageId.
Reconciliation
For every inbound payment, your local invoice record should end up with:
At end of day, list orders by
createdAt window and reconcile against your local set. Any local invoice without a matching SUCCESS order is unpaid; any order without a local invoice is a billing leak.
Errors
See Error catalog for the full list.
Next
Pix cash-out
The outbound counterpart, with approval.
Webhooks overview
Receiving and verifying lifecycle events.
Payment lifecycle
The state machine reference.