Create subscription - Subscriptions - Mercado Pago Developers
Create a subscription

POST

/preapproval
A subscription is the union between a plan and a customer. The main characteristic of this contract is that it has a configured a payment method and is the basis for creating the invoices. You can also create a subscription without a plan.
Request's parameters
auto_recurring
object
Localization: bodyConfiguration data for recurrence It is only required for subscriptions without a plan.
back_url

REQUIRED

string
Localization: bodySuccessful return url. Use this setting to redirect your customers to your site after our checkout. It is only required for subscriptions without a plan.
card_token_id
string
Localization: bodyUnique card token identifier
external_reference
string
Localization: bodyReference to sync with your system. This is a free text field to help you with your integration to link the entities. It is only required for subscriptions without a plan.
Response parameters
id
string
Localization: bodyUnique subscription identifier.
version
number
Localization: bodyHow many times the subscription was modified.
application_id
number
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.
collector_id
number
Localization: bodyUnique ID that identifies your user as a seller. This ID matches your User ID in our ecosystem.
Request
curl
curl -X POST \
    'https://api.mercadopago.com/preapproval' \
    -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
    -H 'Content-Type: application/json' \
    -d '{
  "preapproval_plan_id": "2c938084726fca480172750000000000",
  "reason": "Yoga classes",
  "external_reference": "YG-1234",
  "payer_email": "test_user@testuser.com",
  "card_token_id": "e3ed6f098462036dd2cbabe314b9de2a",
  "auto_recurring": {
    "frequency": 1,
    "frequency_type": "months",
    "start_date": "2020-06-02T13:07:14.260Z",
    "end_date": "2022-07-20T15:59:52.581Z",
    "transaction_amount": 10,
    "currency_id": "ARS"
  },
  "back_url": "https://www.mercadopago.com.ar",
  "status": "authorized"
}'
Answer
json
{
  "id": "2c938084726fca480172750000000000",
  "version": 0,
  "application_id": 1234567812345678,
  "collector_id": 100200300,
  "preapproval_plan_id": "2c938084726fca480172750000000000",
  "reason": "Yoga classes.",
  "external_reference": 23546246234,
  "back_url": "https://www.mercadopago.com.ar",
  "init_point": "https://www.mercadopago.com.ar/subscriptions/checkout?preapproval_id=2c938084726fca480172750000000000",
  "auto_recurring": {
    "frequency": 1,
    "frequency_type": "months",
    "start_date": "2020-06-02T13:07:14.260Z",
    "end_date": "2022-07-20T15:59:52.581Z",
    "currency_id": "ARS",
    "transaction_amount": 10,
    "free_trial": {
      "frequency": 1,
      "frequency_type": "months"
    }
  },
  "payer_id": 123123123,
  "card_id": 123123123,
  "payment_method_id": 123123123,
  "next_payment_date": "2022-01-01T11:12:25.892-04:00",
  "date_created": "2022-01-01T11:12:25.892-04:00",
  "last_modified": "2022-01-01T11:12:25.892-04:00",
  "status": "pending"
}
Errors
400bad_request
400Subscriptions are not available for this country yet
400The payment method account money is not available in your country
400Collector and Application cannot be from different countries
400Field card_token_id is required
400Field payer_email is required
400Invalid value for payer_email, must be a valid email address
400Invalid value for transaction amount, must be a positive number
400Invalid value for transaction amount, only two decimals are allowed
400Invalid value for auto_recurring.currency_id
400Invalid value for auto_recurring.end_date, the date must be after today
400Invalid value for auto_recurring.frequency, must be a positive integer
400Invalid value for auto_recurring.frequency_type, valid ones are days, months
400Invalid value for auto_recurring.start_date, the date must be after today
400Invalid format in auto_recurring.start_date or auto_recurring.end_date
400Invalid value for back_url, must be a valid URL
400Field reason has more than 255 characters
400Field reason has unsupported characters
400Field auto_recurring.frequency is required
400Field auto_recurring.frequency_type is required
400Field auto_recurring.transaction_amount is required
400Field auto_recurring.currency_id is required
400Field auto_recurring.end_date must be after auto_recurring.start_date
400Field external_reference has more than 255 characters
400Field external_reference has unsupported characters
400Already exists a preapproval for user <payer_email> and application <application_id>
400Payer and collector cannot be the same user
400Both payer and collector must be real or test users
400This preapproval cannot be created. The seller does not accept account_money
400This preapproval cannot be created only with payment method account_money
400Cannot operate between different countries
400Cannot create preapproval pending, the feature with account money is disabled for your country.
400Cannot pay an amount lower than min
400Cannot pay an amount greater than max
400You cannot create a preapproval with payment_method in status pending
400You cannot create a new preapproval from a cancelled or inactive template
400The transaction_amount must be the same as preapproval_plan
400Card token was used, please generate new
400Card token was generated without cvv validation
400Invalid request data
401bad_request
401CC_VAL_433 Credit card validation has failed
401Verification of collectors personal data is in process, come back later
401Unauthorized access to resource
401This app cannot create subscriptions without a plan
403bad_request
403The collector does not meet the personal data verification requirements
403The caller is not authorized to access this resource
403Unauthorized seller for this feature AM_VAL_01
500bad_request
500Internal server error