Trying to pay a Pix QR Code in the Sandbox without a registered key = 404 error

404 error when paying a Pix QR Code in the Sandbox

When using the endpoint below in the Sandbox, the API may return 404 Not Found:

POST /v3/pix/qrCodes/pay

This error may occur when the QR Code was generated from a charge created through the interface and the account does not have a registered Pix key.

Cause

In the Sandbox, the QR Code payload may not be registered when:

  • the account does not have a valid Pix key;
  • the charge uses the Bradesco Pix integration, which does not generate this payload in the Sandbox.

In this scenario, although the payload appears on the charge, it cannot be found by the payment endpoint.

Example of the flow with the error

Account without a Pix key
        ↓
Create charge through the interface
        ↓
Get the QR Code payload
        ↓
Send the payment
        ↓
404 Not Found

Request example:

{
  "qrCode": {
    "payload": "payloadObtainedFromCharge"
  },
  "value": 50
}

How to fix it

  1. Register a Pix key in the Sandbox account.
  2. Create a new Pix charge after registering the key.
  3. Get the new QR Code payload.
  4. Send the payload to the payment endpoint.
  5. Validate the result of the operation.
Register Pix key
        ↓
Create new Pix charge
        ↓
Get the payload
        ↓
Pay the QR Code
        ↓
Validate the result
⚠️

Registering the key does not fix previously created QR Codes.

After registering the Pix key, generate a new charge to get another payload.

How to confirm the fix

After running the new test, confirm that:

  • the payload was generated after the key was registered;
  • the URL and the API key belong to the Sandbox;
  • the paying account has a balance;
  • the endpoint returned a response other than 404;
  • the transaction status was updated;
  • the related Webhooks were processed by the application.

See the Pix QR Code payment reference for the request parameters.

Related content


Did this page help you?