Skip to main content
This tutorial walks through receiving a PIX payment end to end. The shortest happy path uses a dynamic EMV QR: you create an order, render the QR to the customer, the customer pays, and a webhook tells you it settled. For the underlying state machine, see Payment lifecycle. For other instrument types, see Instrument types.

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

Response: 201 Created with status: "PENDING" and the provider-rendered QR.
The 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”).
Both encode the same EMV payload; provide both for the best UX.Show the customer the expiresAt so they know how long the QR is valid.
4

Wait for settlement — via webhook

Configure a webhook endpoint and subscribe to payment_order.success. When the customer pays:
Verify the signature (see Verifying signatures), then mark the invoice as paid and ship.
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:
See Pagination for the iteration pattern and Filtering for the available fields.

Static QR (long-lived)

For a reusable QR — e.g., a store-counter sign that any customer can pay — use PIX_CASH_IN_EMV_STATIC:
Note: with the static variant, every settlement to the same QR creates a new 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.