Integration Test
After creating the Zero Dollar Auth validation, it is important to perform integration tests to confirm its functionality. To test the validation, there are two steps:
- Generate card token
- Validate integration
Generate card token
To test the Zero Dollar Auth validation, the first step is to generate a card token. To do this, use our Mercado Pago SDK JS library to capture card data and generate the token.
To obtain the card token, use the test data that we share with you in the table below.
Value | Example |
Card number | 4074090000000004 |
Expiration month | 02 |
Expiration year | 2031 |
Security code | 123 |
Cardholder name | APRO |
Identification type. It can be one of the following types: CPF: Individual Taxpayer Registration, Brazil. CNPJ: National Register of Legal Entities, Brazil. CUIT: Unique Tax Identification Code, Argentina. CUIL: Unique Labor Identification Code, Argentina. DNI: National Identity Document, Argentina. CURP: Single Population Registration Code, Mexico. RFC: Federal Registry of Taxpayers, Mexico. CC: Citizenship Card, Colombia. RUT: Single Tax List, Chile. CI: Identity Card, Uruguay. | CPF |
Document number | 15635614680 |
Validate integration
As a last step, it is necessary to validate the integration using the token obtained in the previous step. To do this, send the parameters described in the table below to the /v1/payments endpoint and execute the request.
Parameter | Type | Description | Example |
token | String | Card token | 12346622341 |
payment_method_id | String | Indicates the identifier of the payment method selected to make the payment | master |
payer.email | String | Payer's email | buyer@examplemail.com |
payer.type | String | Type of identification of the associated payer | guest |
description | String | Description of the validation | "zero dollar card validation with master credit without cvv" |
transaction_amount | Number | Cost of the validation | Always zero (0) for Zero Dollar Auth |
curl
curl -X POST \
'https://api.mercadopago.com/v1/payments'\
Content-Type: application/json
X-Card-Validation: card_validation
Authorization: Bearer {{access_token}}
{
"token": "{{card_token}}",
"payment_method_id": "master",
"payer": {
"email": "{{payer_email}}",
"type" : "guest"
},
"description": "validação de cartão com valor zero dollar master crédito sem cvv",
"transaction_amount": 0
}