Payments

How to accept Pix payments on your website: a developer guide

Build a Pix checkout end to end: create the charge on your backend, show the QR and copy-and-paste code, confirm by webhook, handle expiry. With curl and Node.

By Intopays team

7 min read

A checkout page with a Pix QR code and a copy button, a customer paying from her phone and the green mark of a confirmed orderR$89.90expires in 14:32Copy codePix on your website's checkout

If your website sells to customers in Brazil, offering Pix at checkout is close to mandatory: it's how most Brazilians prefer to pay online, it settles in seconds, and there are no card numbers to protect. For a developer used to Stripe Checkout or Square's Web Payments SDK, the flow is different but simpler — no card form, no 3-D Secure, no authorization and capture. You create a charge, show a QR code, and wait for a webhook.

This guide builds that checkout end to end, with charges issued from the business's own Brazilian bank account through the Intopays API. The architecture applies to any Pix API integration.

What the checkout looks like

A Pix checkout in four screens: the cart, the QR code with copy and paste and a countdown, waiting for the notice, and the confirmed orderPay with Pixcopy code14:32Order paid1Cartthe customer picks Pix2QR codeyour backendcreates the charge3Waitingthe page asksyour backend4Confirmedthe webhookmarked it paid
Four screens: the customer picks Pix, sees the QR code with copy and paste, the page waits for the notice and shows the order paid.
  1. The customer completes the cart and picks Pay with Pix.
  2. Your backend creates a charge for that order and stores its ID.
  3. The page shows the QR code (for desktop shoppers), a copy code button (for mobile shoppers) and a countdown.
  4. The customer pays in their banking app. The business's bank sends a notice, and your webhook marks the order paid.
  5. The page, which keeps asking your backend whether the order is paid, shows the confirmation.

What you need

ItemWhere
A business account with Pix API access at a supported bankSicoob, Sicredi, Banco do Brasil, Santander or Inter
The bank credential registereddashboard, Banking → Credenciais (bank credentials)
An organization API tokendashboard, Integração → Tokens (API tokens)
A registered webhookdashboard, Integração → Webhooks (webhooks)
An active planissuing Pix charges requires a subscription (pricing)

The dashboard is in Portuguese for now; the menu names above are as they appear there. Setting up the bank side is covered in the Sicoob and Inter guides and the bank-by-bank comparison.

Who talks to whom

The most important rule: the token stays on your backend. It acts as the whole organization — whoever has it can create charges, read payments and change webhooks. Never ship it in browser JavaScript, a mobile app or a repository.

Who talks to whom: the browser only talks to your backend; the backend keeps the token and creates the charge at Intopays, which talks to the bank and sends the webhook back to the backendBrowsershows the QRYour backendkeeps the tokenIntopaysone APIYour bankpix.update webhookPOST /v1/pixsis the order paid yet?
The browser only talks to your backend. The backend keeps the token, creates the charge and receives the webhook.

The browser asks your backend "create the Pix for order 1042" and later "is order 1042 paid yet?". Your backend calls Intopays and receives the webhook.

Step 1: create the charge on your backend

With curl, to try it out:

curl -X POST https://api.intopays.com/v1/pixs \
  -H "Authorization: Bearer $INTOPAYS_TOKEN" \
  -H "X-Credential-Key: $INTOPAYS_CREDENTIAL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amountOriginal": 89.90,
    "calendarExpiration": 1800,
    "payerRequest": "Order #1042"
  }'

In a Node.js backend, the same call, storing what matters alongside the order:

async function createPixForOrder(order) {
  const response = await fetch("https://api.intopays.com/v1/pixs", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.INTOPAYS_TOKEN}`,
      "X-Credential-Key": process.env.INTOPAYS_CREDENTIAL_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      amountOriginal: order.totalCents / 100, // the API takes reais (BRL)
      calendarExpiration: 1800, // 30 minutes
      payerRequest: `Order #${order.number}`,
    }),
  })
  if (!response.ok) throw new Error(`Pix not created: ${response.status}`)
  const pix = await response.json()
  await orders.attachPix(order.id, { pixId: pix.id, qrcode: pix.qrcode, url: pix.url })
  return pix
}

Pix only moves Brazilian reais, so the amount is always BRL, with up to two decimals. If your store prices in USD or CAD, convert before you create the charge and show the BRL amount to the customer. The response includes:

FieldUse it for
idthe charge at Intopays; it links the webhook to your order
qrcodethe Pix copy-and-paste payload; the QR code is drawn from it
urla hosted payment page with the QR code and copy-and-paste
transactionIdthe charge's txid at the bank

Choosing the expiry

calendarExpiration is the lifetime in seconds. After it, the bank refuses payment and the customer needs a new QR code.

SituationSuggested expiry
online store checkout15 to 30 minutes (900–1800)
charge sent by link, email or WhatsAppa few hours to a day (86400)
in person, customer at the counter5 to 10 minutes

Too short and customers lose the charge while opening their banking app; too long and you hold inventory for orders that won't be paid.

Step 2: show the QR code and copy-and-paste

Two options:

  • Render it on your page. Draw the QR code from the qrcode field with a library (in the browser, the qrcode npm package: QRCode.toCanvas(canvas, pix.qrcode)) and show the same text with a copy button.
  • Use the hosted page. Redirect to, or open, the url from the response. It needs no login, shows the amount, QR code and copy-and-paste, and never exposes the payer's data. Its wording is in Portuguese, which suits Brazilian shoppers.

Show the amount, the order name and the countdown. A shopper who sees "expires in 14:32" pays sooner.

Step 3: confirm the payment

When the customer pays, your webhook receives a pix.update event with pix.status set to COMPLETED. Your backend verifies the signature, finds the order by pix.id and marks it paid — once, even if the event arrives again. The signature check, with code, is in Pix webhooks.

Meanwhile, the payment page asks your backend every few seconds whether the order is paid:

// in the browser: ask your backend, never Intopays
const timer = setInterval(async () => {
  const { status } = await fetch(`/api/orders/${orderId}/status`).then((r) => r.json())
  if (status === "PAID") {
    clearInterval(timer)
    showConfirmation()
  }
}, 3000)

That endpoint reads your own database, which the webhook updated. If the shopper closes the tab before confirmation, nothing is lost: the webhook still marks the order paid, and you send the confirmation email.

Step 4: edge cases

CaseWhat to do
The charge expired unpaidoffer a "new Pix code" button that creates another charge for the same order
The shopper clicked "Pay with Pix" twiceif the order already has a charge within its expiry, return that one
The webhook never arrivedread the charge with GET /v1/pixs/:id when the expiry passes (query Pix)
The shopper paid two charges for one ordertreat it as a duplicate and refund one through the bank
The order total changedcreate a new charge; an issued charge's amount is fixed (amountModificationType 0, the default)

Costs, and where the money goes

The charge is issued from the business's own account: the Pix settles there in seconds, any time of day. The per-Pix fee is whatever the bank charges; Intopays adds no per-transaction fee and never holds the funds — it charges a monthly plan. Compared with a card processor, there's no percentage per sale, no payout delay and no chargebacks; the business can refund a Pix for up to 90 days.

Pre-launch checklist

  1. The token lives only on the backend, in an environment variable.
  2. The webhook verifies the signature and is idempotent.
  3. The page shows the QR code, copy-and-paste and the countdown, and works on a phone.
  4. An expired charge offers a way to generate a new one.
  5. Orders with no notice after the expiry are read through the API.
  6. You made a small real payment and watched the order turn paid on its own.

Frequently asked questions

Can I accept Pix without a Brazilian company?

Not with this setup: charges are issued from a Brazilian business account, which requires a CNPJ. Without one, a cross-border payment provider can collect Pix on your behalf and pay you out abroad, at its own fees and timelines.

Can I just use the hosted payment page?

Yes. Every charge comes back with a url to a public page showing the amount, QR code and copy-and-paste code. Redirect the shopper to it or send it by message.

How fast does the order show as paid?

The Pix itself settles in seconds. The bank's notice usually follows right away; without it, open charges are checked at the bank in 30-second cycles while within their expiry.

Can I reuse one QR code for many orders?

Not for a checkout. Each order needs its own charge, with its own amount and ID, so your system knows which order was paid. A fixed QR code is for a counter poster: see static Pix.

Which banks can the shopper pay from?

Any bank or wallet in Brazil that offers Pix. Only the receiving business's bank needs to be integrated.

All articles

Keep reading

An integration created in Banco Inter's online banking becomes a certificate and key bundle, and your system starts generating Pix QR codes.crt + .keyBanco Inter Pix API

Payments

Banco Inter Pix API: how to integrate it

How to create a Banco Inter API integration, download its certificate and key, authenticate, issue a first Pix charge and reuse the same credential for boletos.

6 min readRead the article
Your system sends the boleto request, the bank registers it, and the boleto comes out with a barcode and a Pix QR codePOST /v1/boletosBarcode + Pix QRRegistered

Payments

Boleto bancário explained, and how to issue boletos via API

What a boleto is, how Brazilians pay it, why it survives next to Pix, and what a business needs to issue registered boletos through its own bank's API.

6 min readRead the article
An NFC-e receipt comes out of the checkout printer with its lookup QR code, after SEFAZ authorized itNFC-e · model 65SEFAZ

Payments

Brazil e-invoicing: NFC-e vs NF-e explained

How Brazil's electronic invoices work: NFC-e (model 65) vs NF-e (model 55), SEFAZ authorization, what a company needs to issue them and the usual pitfalls.

7 min readRead the article