Pular para o conteúdo

Instant Pix (JSR)

Take an immediate Pix payment in-app, device-signed with a passkey (FIDO2) and no redirection. This is the JSR counterpart of Instant Pix (redirect): instead of sending the payer to their bank, the payer approves on their own device with the passkey registered during account linking.

Method sequence

  1. enrollments.listByUserJsr(cpf, { deviceId }) — gate: confirm the payer has an AUTHORISED enrollment and pick it.
  2. pix.getDetails({ pixKey }) — resolve the Pix key into the payee's account so you can build the creditor (skip this for a QR Code — see Pay a QR Code).
  3. consents.createJsr(req) — open a JSR consent with a payment carrying details, value, cpfCnpj, redirectUri, and the creditor. Returns { id, consentId, fidoSignOptions }; id is the paymentRequestId.
  4. [device] the device calls navigator.credentials.get() with consent.fidoSignOptions and produces a FIDO2 assertion.
  5. payments.processJsr(req) — submit the assertion plus riskSignals to execute the payment immediately. Check the result with the isPaid helper.

Steps 4–5 are identical across every JSR flow — see Execute a JSR payment for the full code.

Sequence diagram

Instant Pix (JSR) — gate on the enrollment, resolve the payee, consent, sign on device, execute immediately

Code

Steps 1–3: gate on the enrollment, resolve the payee, and open the consent. Both consents.createJsr and payments.processJsr require the clientIp (the X-Client-IP header).

// 1) Gate: an AUTHORISED enrollment is required
const user = await client.enrollments.listByUserJsr(cpf, { deviceId: riskSignals.deviceId });
const enrollment = user.enrollments[0];

// 2) Resolve the Pix key into the payee account
const details = await client.pix.getDetails({ pixKey });

// 3) Create the consent with the full transfer payload
const consent = await client.consents.createJsr({
enrollmentId: enrollment.enrollmentId,
payment: {
  details: 'Instant Pix',
  value: 150.5,
  cpfCnpj: cpf,
  redirectUri: 'https://app.example.com/payment-success',
  creditor: {
    name: details.account.name,
    personType: details.account.personType,
    cpfCnpj: details.account.cpfCnpj,
    accountNumber: details.account.accountNumber,
    accountIssuer: details.account.accountIssuer,
    accountPixKey: details.pixKey,
    accountIspb: details.account.accountIspb,
    accountType: details.account.accountType,
  },
},
fidoSignOptions: { platform: 'ANDROID' },
}, { clientIp });
// consent.id is the paymentRequestId — sign on device and call payments.processJsr,
// see Execute a JSR payment

Next steps