Home
Documentation
Resources
Certifications
Community
Create subscription - Subscriptions - Mercado Pago Developers

Intelligent search powered by OpenAI 

Create a subscription

POST

https://api.mercadopago.com/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
BODY
preapproval_plan_id
string
Unique subscription plan identifier. This is an optional field. Our model supports creating subscriptions with or without a plan. If you create a subscription with plan we will take the recurring settings from the plan t...View more
reason
string
It is a short description that the subscriber will see during the checkout process and in the notifications. It is only required for subscriptions without a plan.
external_reference
string
Reference 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.
payer_email
string

REQUIRED

To create a subscription it is necessary to link it with an email. Then you will get a unique identifier to identify the subscriber.
Response parameters
id
string
Unique subscription identifier.
version
number
How many times the subscription was modified.
application_id
number
Unique 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
Unique ID that identifies your user as a seller. This ID matches your User ID in our ecosystem.
Errors

400Error

400

Bad-Request

401Error

401

Unauthorized

403Error

403

Forbidden

500Error

500

Error

Request
curl -X POST \
    'https://api.mercadopago.com/preapproval'\
    -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer TEST-5599*********291-02171*********139a4791e*********f7f5835-1*********' \
    -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"
}'
Sample answer
{
  "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"
}