Crear una suscripción/preapprovalGenera una suscripción con todas las configuraciones que necesites.
POST
Parámetros para la solicitud
auto_recurring
Localización: bodyDatos de recurrencia de suscripciónobject
back_url
Localización: bodyurl de retornostring
collector_id
Localización: bodyIdentificador de vendedorstring
external_reference
Localización: bodyValor de referencia de suscripciónstring
Parámetros de respuesta
id
Localización: bodyidstring
payer_id
Localización: bodypayer_idnumber
payer_email
Localización: bodypayer_emailstring
back_url
Localización: bodyback_urlstring
Solicitud
curl
curl -X POST \
'https://api.mercadopago.com/preapproval' \
-H 'Authorization: Bearer ACCESS_TOKEN_ENV' \
-d '{
"auto_recurring": {
"frequency": 1,
"frequency_type": "months",
"transaction_amount": 10,
"currency_id": "ARS",
"start_date": "2020-06-02T13:07:14.260Z",
"end_date": "2022-07-20T15:59:52.581Z"
},
"back_url": "https://www.mercadopago.com.ar",
"external_reference": 23546246234,
"payer_email": "test_user@testuser.com"
}'
Respuesta
json
{
"id": "2c938084726fca480172750000000000",
"payer_id": 123123123,
"payer_email": "test_user@testuser.com",
"back_url": "https://www.mercadopago.com.ar",
"collector_id": 100200300,
"application_id": 1234567812345678,
"status": "pending",
"reason": "Suscripcion Particular",
"external_reference": 23546246234,
"date_created": "2020-06-02T13:07:14.260Z",
"last_modified": "2020-06-02T13:07:14.263Z",
"init_point": "https://www.mercadopago.com/MLB/debits/new?preapproval_id=2c938084726fca480172750000000000",
"sandbox_init_point": "https://sandbox.mercadopago.com/MLB/debits/new?preapproval_id=2c938084726fca480172750000000000",
"auto_recurring": {
"frequency": 1,
"frequency_type": "months",
"transaction_amount": 10,
"currency_id": "ARS",
"start_date": "2020-06-02T13:07:14.260Z",
"end_date": "2022-07-20T15:59:52.581Z"
},
"version": 0
}
Errores
400bad_request
Card token was used, please generate new
Card token was generated without cvv validation
Subscriptions are not available for this country yet
The payment method account money is not available in your country
Collector and Application cannot be from different countries
card_token_id is required
payer_email is required
Invalid value for payer_email, must be a valid email address
Invalid value for transaction amount, must be a positive number
Invalid value for transaction amount, only two decimals are allowed
Cannot pay an amount lower than ${currency_id} ${min amount}
Cannot pay an amount greater than ${currency_id} ${max amount}
The transaction_amount must be the same as preapproval_plan
You cannot create a new preapproval from a cancelled/inactive template
back_url is required
Invalid value for back url, must be a valid URL
reason is required
reason has more than 255 characters
reason has unsupported characters
auto_recurring.frequency is required
Invalid value for frequency, must be a positive integer
Invalid value for frequency type, valid ones are [days, months]
auto_recurring.frequency_type is required
auto_recurring.transaction_amount is required
auto_recurring.currency_id is required
Invalid field -> auto_recurring.currency_id
Invalid value for auto_recurring.end_date, the date must be after today
auto_recurring.end_date must be after auto_recurring.start_date
Invalid value for auto_recurring.start_date, the date must be after today
Invalid format in auto_recurring.start_date or auto_recurring.end_date
external_reference has more than 255 characters
external_reference has unsupported characters
Already exists a preapproval for user ${payer_email} and application ${application_id}
Cannot operate between different countries
Payer and collector cannot be the same user
Both payer and collector must be real or test users
This preapproval cannot be created: The seller does not accept account_money
This preapproval cannot be created only with payment method account_money
You cannot create a preapproval with payment_method in status pending
Cannot create preapproval pending, the feature with account money is disabled for your country.
Invalid request data
401bad_request
CC_VAL_433
Verification of collectors personal data is in process, come back later
Unauthorized access to resource
This app cannot create preapprovals without a plan
403bad_request
The collector does not meet the personal data verification requirements
The caller is not authorized to access this resource
AM_VAL_01 Unauthorized seller for this feature
404bad_request
The preapproval with id ${preapproval id} does not exist
Card token service not found
¿Te resultó útil esta información?