I'm trying to generate a card token with the MercadoPago API, specifically using the resource https://api.mercadopago.com/v1/card_tokens, with the following JSON in the request:
{
"cardNumber": "4509953566233704",
"email": "[email protected]",
"cardholder": {
"name": "APRO"
},
"expirationYear": "2025",
"expirationMonth": "11",
"securityCode": "123"
}
The web service responds with the following:
{
**"id": "28e607d8cbceb068e7b99e84c6988216"**,
"public_key": "public key de test",
"first_six_digits": "450995",
"expiration_month": 11,
"expiration_year": 2025,
"last_four_digits": "3704",
"cardholder": {
"identification": {},
"name": "APRO"
},
"status": "active",
"date_created": "2023-05-09T01:10:42.346-04:00",
"date_last_updated": "2023-05-09T01:10:42.346-04:00",
"date_due": "2023-05-17T01:10:42.346-04:00",
"luhn_validation": true,
"live_mode": true,
"require_esc": false,
"card_number_length": 16,
"security_code_length": 3
}
But when I try to make the following request to generate a payment in MercadoPago using the resource /v1/payments (POST method):
{
"payer": {
"entity_type": "individual",
"type": "customer",
"first_name": "APRO",
"last_name": "Test",
"address": {},
"email": "[email protected]",
"identification": {}
},
"description": "Celular Xiaomi Redmi Note 11S 128gb 6gb Ram Original Global Blue Version",
"installments": 1,
"issuer_id": "123456",
**"token": "28e607d8cbceb068e7b99e84c6988216"**,
"payment_method_id": "visa",
"transaction_amount": 100
}
The web service responds with:
{
"message": "Cannot infer Payment Method",
"error": "bad_request",
"status": 400,
"cause": [
{
"code": 2131,
"description": "payment methods inference error",
"data": "09-05-2023T05:13:19UTC;e8d91d35-ea9a-4af9-993c-d08a4c058190"
}
]
}
After searching the internet, I found out that Cannot infer Payment Method refers to attempting to pay with a card that was originally selected for another option, for example, entering a credit card number for the debit card option.
Do you have any solution for this issue? I have searched the internet but cannot find an answer.