Integration test
It is crucial to test the entire flow before going into production, ensuring that payment creation is done correctly and that messages are effective in communicating with the user. A good experience for your customers at the checkout helps improve conversion.
To perform a test purchase, it is necessary to use the test credentials of your production user. To obtain them, access Application details > Credentials within the Developer dashboard or in your Mercado Pago account by accessing Your Business > Settings > Management and Administration > Credentials.
You can use test cards of local payment methods and simulate different payment responses, without the need to use a real card.
For this, depending on your country, use one of the credit cards we provide below.
| Card | Number | Security code | Expiration date |
| Mastercard | 5254 1336 7440 3564 | 123 | 11/25 |
| Visa | 4013 5406 8274 6260 | 123 | 11/25 |
| American Express | 3743 781877 55283 | 1234 | 11/25 |
To test different payment results, fill in the desired status in the cardholder's name (field card_holder_name):
| Payment Status | Description | Identity document |
APRO | Approved payment | 123456789 |
OTHE | Declined for general error | 123456789 |
CONT | Pending payment | - |
CALL | Declined with validation to authorize | - |
FUND | Declined for insufficient amount | - |
SECU | Declined for invalid security code | - |
EXPI | Declined due to due date issue | - |
FORM | Declined due to form error | - |
CARD | Rejected for missing card_number | - |
INST | Rejected for invalid installments | - |
DUPL | Rejected for duplicate payment | - |
LOCK | Rejected for disabled card | - |
CTNA | Rejected for non-permitted card type | - |
ATTE | Rejected due to exceeded PIN attempts | - |
BLAC | Rejected for being on the blacklist | - |
UNSU | Not supported | - |
TEST | Used to apply amount rules | - |
Test a rejected payment in Automatic Payments Messaging
Below, we present a test scenario to validate the correct functioning of your recurring payments integration.
- Use your Checkout API integration to Get card data and create the token.
- Create the Customer by sending a POST to the endpoint v1/customers with the email
test@testuser.com. - Associate the previously tokenized card to the customer by sending a POST to the endpoint /v1/customers/{customer_id}/cards. You must use the
customer_idobtained in the request to create the customer in the path of this request, and send thecard_tokenin the body. - Create the recurring payment without CVV. For the
card_holder_namefield, enter the valueOTHE, which will generate a rejected payment. If you need more information on how to create these payments, go to Automatic Payments Messaging.
curl
curl --location 'https://api.mercadopago.com/v1/payments' \ --header 'Content-Type: application/json' \ --header 'X-Idempotency-Key: sada21211112311' \ --header 'Authorization: Bearer ACCES_TOKEN \ --data '{ "description": "First recurring payment", "installments": 1, "token": "4c6518fe544c152ed9178d4bc5f7d9a7", "payer": { "id": "3023406418-Jo6Bh3O0fmX85V", "type": "customer" }, "payment_method_id": "master", "transaction_amount": 300 }'
The response to this request should return a rejected payment, according to the data entered for the payment method.