A Brazilian checkout can display the correct total and still charge the wrong instalment plan or mark an unpaid Pix order as paid. This guide separates three assertions: what the customer owes, what the provider confirms and what the merchant eventually receives. The runnable cases use integer centavos and one deliberately small payment-state model.

Checkout scope: Brazil
CurrencyBRL (Brazilian real)
Methods discussed
  • Card instalments under the provider's configured terms
  • Pix QR code or copyable payment string
  • Provider credit products that can finance a Pix transfer
Authentication scope

For the Pix flow discussed here, the shopper approves payment in their banking app. Card authentication depends on the configured card flow.

This is a Pix integration description, not a conclusion that Brazil has no authentication rules.

Stripe: Pix payment flow · Checked
Local tool limitsNo Elo or Hipercard profiles. The identity generator does not produce CPF identifiers; use documented provider sandbox fixtures.

Reconcile instalments in centavos

Keep the order total, instalment count, interest and any fees as separate values. The number of instalments available depends on the configured product and provider. Customer repayment dates are not the same as the merchant’s settlement schedule; do not infer one from the other.

In our interest-free teaching example, R$100.00 is 10000 centavos. Three parts are 3334, 3333, 3333: the extra centavo goes to the first part. This is an explicit demo rounding policy, not a claim about every Brazilian acquirer. A provider-supplied schedule must be reconciled against its own terms and total payable.

export function instalments(totalMinor, count, maxCount) {
  // Demo policy: at most 36 instalments and at least one minor unit per part.
  // The provider's actual interest, fees and rounding schedule take precedence.
  if (!positiveMinor(totalMinor) || !Number.isInteger(maxCount) || maxCount < 1 ||
      maxCount > 36 || !Number.isInteger(count) || count < 1 ||
      count > maxCount || count > totalMinor) throw new RangeError('Invalid plan');
  const base = Math.floor(totalMinor / count);
  const extra = totalMinor % count;
  return Array.from({ length: count }, (_, i) => base + Number(i < extra));
}
CaseInput / conditionExpected result
br-three-parts10000 centavos / 3; demo maximum=12[3334,3333,3333]
br-one-part10000 centavos / 1[10000]
br-at-maximum12000 centavos / configured maximum 12[1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000]
br-too-many13 requested, maximum=12"invalid-plan"
br-zero-partsZero instalments"invalid-plan"
br-fractionalNon-integer instalment count"invalid-plan"
br-display123456 centavos rendered for pt-BR"R$ 1.234,56"

The display case renders 123456 centavos as Brazilian currency. Formatting is an output step; do not feed R$ 1.234,56 into a generic floating-point parser. Test the raw integer amount separately from the translated label and check that changing instalments does not silently change the selected currency.

Distinguish Pix from the credit used to fund it

Pix is an instant transfer system. Products such as Pix Parcelado can finance a buyer’s payment through a card or credit line; the buyer’s instalments and the seller’s receipt are distinct. This is a provider product, not a promise that every Pix checkout offers financing. See Mercado Pago's Pix Parcelado explanation1.

A web checkout still has a waiting period while the shopper acts in a banking app and your server obtains confirmation. Stripe documents both a QR code and a copyable Pix string in its Pix payment flow2. Card flows can also wait for authentication or confirmation; Pix is not the only asynchronous path.

Test a payment that outlives the browser timer

Our offline model compares a normalized provider observation with the server-owned merchant, order, payment reference, amount, currency and environment. It is not a webhook verifier. A real adapter must authenticate the provider message before mapping it into this model; changing a browser flag to “verified” is not authentication.

export function reconcileInstant(current, observation, order) {
  // observation must be mapped from an authenticated provider response/webhook.
  // This pure model neither verifies a signature nor persists an atomic write.
  const base = { ...current, fulfill: false };
  const keys = ['provider', 'merchant', 'orderId', 'paymentId', 'currency', 'mode'];
  if (!order || !positiveMinor(order.amountMinor) || order.mode !== 'sandbox' ||
      keys.some(k => typeof order[k] !== 'string' || !order[k]) ||
      !observation || keys.some(k => observation[k] !== order[k]) ||
      observation.amountMinor !== order.amountMinor ||
      !['pending', 'succeeded', 'failed', 'expired'].includes(observation.status) ||
      !['pending', 'succeeded', 'failed', 'expired'].includes(current.status)) {
    return { ...base, review: true };
  }
  if (current.review || current.status === observation.status) return base;
  if (current.status !== 'pending') {
    // Delayed pending messages cannot undo a terminal result.
    return observation.status === 'pending' ? base : { ...base, review: true };
  }
  return { ...base, status: observation.status, fulfill: observation.status === 'succeeded' };
}

export function instantPaymentView(current, expiresAt, now) {
  if (![expiresAt, now].every(Number.isSafeInteger)) throw new TypeError('Explicit clock required');
  if (current.review) return 'review';
  if (current.status === 'succeeded') return 'paid';
  if (current.status === 'failed' || current.status === 'expired') return 'retry-after-reconciliation';
  return now >= expiresAt ? 'check-provider-status' : 'waiting-for-payment';
}
CaseInput / conditionExpected result
pix-waitQR displayed, no provider result{"fulfillments":0,"view":"waiting-for-payment"}
pix-timeoutLocal QR timer expires without a final provider result{"fulfillments":0,"view":"check-provider-status"}
pix-delayed-successVerified success arrives after local timer expiry{"fulfillments":1,"view":"paid"}
pix-duplicateSuccess delivered twice, then delayed pending{"fulfillments":1,"view":"paid"}
pix-mismatchSuccess has wrong amount{"fulfillments":0,"view":"review"}
pix-conflictProvider expiry followed by conflicting success needs reconciliation{"fulfillments":0,"view":"review"}

When the local QR timer expires, the UI asks the server to check status. It does not conclude that the transfer failed. A delayed successful observation can still mark the order paid. A provider-reported expiry followed by contradictory success goes to review. Repeated success must not create a second fulfilment job; use a database transaction and a unique order/job key as described in the Stripe integration guide.

On mobile, show Pix Copia e Cola as well as a QR code so the shopper can pay on the same phone. Test copy success and failure, returning from the bank app, refreshing the order page and a slow connection. Retain the existing payment reference until reconciliation determines whether a new attempt is needed. The UPI return cases for India exercise the same browser-return boundary with a different funding and authentication flow.

Know what the local tools cannot supply

The card profiles do not contain Elo or Hipercard, and the name and address tool does not generate CPF identifiers. Do not substitute a random identifier for a provider’s required sandbox fixture. A locally unrecognized network also does not establish that your provider rejects it: use the provider’s configured method capabilities, not an incomplete regex, to decide which payment routes to offer. The brand detection guide explains that boundary.

Replay the Brazil examples

Extract the shared example project and run with Node.js 22 or later:

node guide-demo.mjs brazil-instalments
node guide-demo.mjs brazil-pix
node --test guide-examples.test.mjs regional-guide-examples.test.mjs

The tests check conservation of centavos across rounding boundaries and reject invalid counts. Extend the payment form test plan with your provider’s actual instalment policy, Pix expiry configuration and sandbox notification flow.

Frequently Asked Questions

Does this generator support Elo, Hipercard or CPF?
No. Elo and Hipercard are absent from the local card profiles, and the identity tool does not generate CPF. Use the selected provider’s documented test data.
Can Pix be paid in instalments?
Some providers offer credit products that finance a Pix payment. Distinguish those buyer-side terms from the Pix transfer and the merchant’s receipt.
Does an expired QR timer prove that an order is unpaid?
No. A local timer cannot replace server reconciliation with the payment provider. Check the existing payment before offering another attempt.