How to test features
1. Testing Credit Card Payment
To simulate a credit card charge, you can use test cards with the endpoint for creating a charge via credit card. Here is an example of a valid test card:
Card Number:
4444 4444 4444 4444
Expiration Date: Any month after today's date
CVV:123
(or any other 3 random digits)
You can also use credit card number generators for testing. These generated cards will work and return a successful payment confirmation.
To simulate a payment error, use the test cards below:
Mastercard:
5184019740373151
Visa:4916561358240741
2. Testing Bill Payment
To test bill payments in the Sandbox environment, you can use the barcode ("linha digitável") from any boleto generated within your own Asaas Sandbox account. Simply submit the barcode to the respective endpoint to simulate payment.
3. Testing Pix Transfers
BACEN (Brazilian Central Bank) provides a set of Pix keys specifically for testing transfers in Sandbox. You can use the test accounts below:
Name: Joao Silva
CPF/CNPJ: 99991111140
Key: [email protected]
Bank: Virtual Messaging 04 (99999004)
Agency: 0001
Account: 12345678 (CACC)
Name: Joao Silva Silva
CPF/CNPJ: 99992222263
Key: [email protected]
Bank: Virtual Messaging 04 (99999004)
Agency: 0002
Account: 11345678 (CACC)
Name: Jose Silva
CPF/CNPJ: 99993333387
Key: [email protected]
Bank: Virtual Messaging 04 (99999004)
Agency: 0003
Account: 12145678 (CACC)
Name: Jose Silva Silva
CPF/CNPJ: 99994444409
Key: [email protected]
Bank: Virtual Messaging 04 (99999004)
Agency: 0004
Account: 12315678 (CACC)
Name: Jose da Silva
CPF/CNPJ: 99995555514
Key: [email protected]
Bank: Virtual Messaging 04 (99999004)
Agency: 0004
Account: 12341678 (CACC)
4. Testing Static Pix QR Code Payments
To test the integration flow of a static Pix QR Code, follow these steps:
- First, create a static QR Code in Sandbox.
- Then, use the endpoint Pay a QR Code and send the payload of the generated code.
POST
/v3/pix/qrCodes/pay
Check the complete reference here
{
"qrCode": {
"payload": "00020126710014br.gov.bcb.pix01362ae3db4c-9f04-44de-9a39-adcc98a334c20209Churrasco520400005303986540550.005802BR5913John Donate6009Joinville62290525JHOND00000000465493ASA6304DB5E"
},
"value": 50
}
Once this request is sent, a Pix charge will be automatically created. The fields pixTransaction
and pixQrCodeId
will be populated with the transaction data.
5. Can the Critical Action Token Be Disabled in Sandbox?
Yes, it is technically possible to disable the token requirement for transfer operations in the Sandbox environment. However, we strongly emphasize that the token is a security measure, and disabling it increases the risk of unauthorized actions.
We recommend:
- Restricting transfers to specific IP addresses that interact with the account.
- Blocking any requests from IPs outside of this trusted list.
- Enabling our webhook-based withdrawal validation mechanism for an extra layer of protection.
To request this token deactivation, please contact our Integrations Success team.
6. Trying to Pay a Pix QR Code in Sandbox Without a Registered Key = 404 Error
Context
If you attempt to use the following route:
POST /v3/pix/qrCodes/pay
in the Sandbox environment, you may receive a 404 Not Found
error when paying a Pix QR Code that was:
- Generated from a charge created via the web interface, and
- No Pix key is registered on the account.
This error occurs because the QR Code payload is not generated in Sandbox if:
- The account has no valid Pix key, or
- The charge was created using Bradesco’s Pix integration, which does not generate a payload in the test environment.
Important Note
Although the 404 error is technically accurate (the payload truly doesn't exist), it may be confusing for developers, especially since:
- The endpoint is valid
- The payload is correctly extracted from the charge
- The expectation is that the QR Code would work for testing
How to Avoid the Error
To successfully test Pix QR Code payments in the Sandbox:
- Register a Pix key to your test account
- Generate a new charge with a QR Code linked to that key
This ensures that the QR Code will have a valid payload, avoiding the 404 error.
Updated 6 days ago