MercadoPago Custom Subscription Integration

Unofficial Content

This document shows how to create a Subscription without leaving the seller site. 

You can create a Subscription directly or from a Plan or Template. These are the steps that need to be followed:

  • Setting Credentials
  • Create a Plan (optional)
  • Submit a form in which the user will select the method of payment and card details, safely.
  • Get Card Token
  • Create a Subscription with or without a plan

Create a Plan (optional)

To create a Plan you first need to fulfill this PlanInputSDT with de corresponding information:


Then call the CreatePlan procedure:

&AccessToken = GetAccessToken()
MercadoPago.Subscriptions.CreatePlan(&AccessToken, &PlanInputSDT, &PlanInfoSDT, &Message, &ErrorCode)
If &ErrorCode = 0
   &PlanId = &
   msg(format('Plan %1 successfully created', &PlanId), status)
   msg(&Message.Description, status)

The result of this operation is an SDT (&PlanInfoSDT) with all the information of the created plan.

Submit card information form 

Here you will need to create a Web Panel where the user will enter their credit card information safely.  See MercadoPago Custom Checkout

After submitting the panel, you will get a Token for the credit card, required for the next step. 

Create a Subscription

To create a subscription from a Plan, use the SubscriptionInputWithPlanSDT and fill it with the PlanId, PayerEmail, and the CardToken. Then call the CreateSubscriptionWithPlan procedure.

&SubscriptionInputWithPlanSDT = new()
&SubscriptionInputWithPlanSDT.preapproval_plan_id = &PlanId
&SubscriptionInputWithPlanSDT.card_token_id = &CardToken
&SubscriptionInputWithPlanSDT.payer_email = !''
MercadoPago.Subscriptions.CreateSubscriptionWithPlan(&AccessToken, &SubscriptionInputWithPlanSDT, &SubscriptionInfoSDT, &Message, &ErrorCode)
If &ErrorCode = 0
     msg(format('Subscription %1 successfully created', &, status)
     msg(&Message.Description, status)

Create a Subscription without a Plan

To create a Subscription without a Plan, use the SubscriptionInputSDT to fill in the required information and then call the CreateSubscription procedure.