AI resources

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.

CardNumberSecurity codeExpiration date
Mastercard5031 7557 3453 060412311/25
Visa4009 1753 3280 617612311/25
American Express3711 803032 57522123411/25

To test different payment results, fill in the desired status in the cardholder's name (field card_holder_name):

Payment StatusDescriptionIdentity document
APROApproved payment123456789
OTHEDeclined for general error123456789
CONTPending payment-
CALLDeclined with validation to authorize-
FUNDDeclined for insufficient amount-
SECUDeclined for invalid security code-
EXPIDeclined due to due date issue-
FORMDeclined due to form error-
CARDRejected for missing card_number-
INSTRejected for invalid installments-
DUPLRejected for duplicate payment-
LOCKRejected for disabled card-
CTNARejected for non-permitted card type-
ATTERejected due to exceeded PIN attempts-
BLACRejected for being on the blacklist-
UNSUNot supported-
TESTUsed 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.

  1. Use your Checkout API integration to Get card data and create the token.
  2. Create the Customer by sending a POST to the endpoint v1/customers with the email test@testuser.com.
  3. 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_id obtained in the request to create the customer in the path of this request, and send the card_token in the body.
  4. Create the recurring payment without CVV. For the card_holder_name field, enter the value OTHE, 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.

For more information about the testing process, visit the Make test purchase section in Checkout API or Checkout Bricks.