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
When the customer pays, your registered cash-in endpoint (set up during onboarding) receives a webhook delivery with Verify the
status: "SUCCESS". The body is the full PaymentOrder document — no event envelope:X-Webhook-Signature header before trusting the payload (see Verifying signatures), persist, acknowledge with a 2xx and the literal response body success, then mark the invoice as paid and ship. Deliveries are at-least-once: deduplicate by (id, etag) and discard any delivery whose ordVersion is lower than the highest you have already processed for that order.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. As with every payment order, amount is required and must be a positive integer in minor units; every payer settles that fixed amount:
SUCCESS webhook delivery for a new logical order. The platform manages this — your webhook consumer processes each delivery independently, deduplicating by (id, etag) (each settlement carries its own order id).
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 settled-order deliveries.
Payment lifecycle
The state machine reference.