Did you find this information useful?
Yes
No
Create a subscription plan/preapproval_planA plan is a template to create subscriptions thats tell how often and how much to charge your customers. Plans can be created with free trials, biiling cycles and more. The subscriptions created from a plan are related to it and allows synchronizing modifications such as reason or amount.
POST
Products that use it:
Request's parameters
auto_recurring
Localization: bodyConfiguration data for recurrence.object
back_urlstring
Localization: bodySuccessful return URL. Use this setting to redirect your customers to your site after our checkout.REQUIRED
payment_methods_allowed
Localization: bodyPayment methods enabled at checkout.object
reasonstring
Localization: bodyIt is a short description that the subscriber will see during the checkout process and in the notifications.REQUIRED
Response parameters
id
Localization: bodyUnique subscription plan identifier.string
application_id
Localization: bodyUnique ID that identifies your application/integration. One of the keys in the pair that make up the credentials that identify an application/integration in your account.number
collector_id
Localization: bodyUnique ID that identifies your user as a seller. This ID matches your User ID in our ecosystem.number
reason
Localization: bodyIt is a short description that the subscriber will see during the checkout process and in the notifications.string
Request
curl
curl -X POST \
'https://api.mercadopago.com/preapproval_plan' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN \
-H 'Content-Type: application/json' \
-d '{
"reason": "Yoga classes",
"auto_recurring": {
"frequency": 1,
"frequency_type": "months",
"repetitions": 12,
"billing_day": 10,
"billing_day_proportional": true,
"free_trial": {
"frequency": 1,
"frequency_type": "months"
},
"transaction_amount": 10,
"currency_id": "ARS"
},
"payment_methods_allowed": {
"payment_types": [
{}
],
"payment_methods": [
{}
]
},
"back_url": "https://www.yoursite.com"
}'
Answer
json
{
"id": "2c938084726fca480172750000000000",
"application_id": 1234567812345678,
"collector_id": 100200300,
"reason": "Yoga classes",
"auto_recurring": {
"frequency": 1,
"frequency_type": "months",
"repetitions": 12,
"billing_day": 10,
"billing_day_proportional": true,
"free_trial": {
"frequency": 1,
"frequency_type": "months"
},
"transaction_amount": 10,
"currency_id": "ARS"
},
"payment_methods_allowed": {
"payment_types": [
{}
],
"payment_methods": [
{}
]
},
"back_url": "https://www.mercadopago.com.ar",
"external_reference": 23546246234,
"init_point": "https://www.mercadopago.com.ar/subscriptions/checkout?preapproval_plan_id=2c938084726fca480172750000000000",
"date_created": "2022-01-01T15:12:25.892Z",
"last_modified": "2022-01-01T15:12:25.892Z",
"status": "active"
}
Errors
400bad_request
400
400Parameter reason is required
400Parameter external_reference has unsupported characters
400Parameter auto_recurring is required
400Parameters frequency and frequency_type are required in the recurring payments scheme
400Invalid value for back_url. Must be a valid URL
400Invalid value for status. Valid ones ar active, inactive, cancelled.
400Invalid value for transaction_amount, must be a positive number
400Invalid value for transaction_amount, must be a positive integer
400Invalid value for transaction_amount, only two decimals are allowed
400Invalid value for payer_email, must be a valid email address
400Invalid value for currency_id
400Invalid value for frequency, must be a positive integer
400Invalid value for frequency_type
400Invalid value for frequency_type, valid ones are days or months
400Invalid value for repetitions, mus be a positive integer
400Cannot pay an amount greater than max
400Cannot pay an amount lower than min
400Cannot operate with this currency_id in this site
400Cannot operate between diferent countries
400Field currency_id is required
400Reason has unsupported characters
400Plan are not available for this country yet
401bad_request
401Must provide your access_token to proceed
404bad_request
404The application id does not exist
500bad_request
500Internal server error