API Reference

Subscription object

A Subscription is a service that your customers can sign up for and the installments are generated automatically depending on the payment attributes you choose for the Subscription. There are two ways to create a Subscription, assign products that were already created or create the product(s) within the request. For the first option, the existant Product's ID's must be sent, alongside the quantity of each of them. For the second option, all the information of the product must be sent in order to create the product. This information is the same as required on the product object. The quantity of each product is required as well. Examples of both cases can be found below. You can also assign different payment options to the Subscription, which are mentioned below in the attributes.

A Subscription may have extra fields that are data that are requested from the customer when signing up for the Subscription, in addition to their name and email, which are always requested.

{
    "subscription": {
        "name": "July gym subscription",
        "recurrence": "month"
    },
    "products": [
        {
            "id": "d46f16cf-a54c-4c28-8880-2c186638ba9c",
            "quantity": 1
        }
    ]
}
{
    "subscription": {
        "name": "July gym subscription",
        "recurrence": "month"
    },
    "products": [
        {
            "name": "Boxing classes",
            "description": "First semester 2022",
            "value": 40000,
            "external_id": "005",
            "quantity": 1
        }
    ]
}

Attributes

The attributes available to a Subscription object are:

NameTypeDescriptionRequired
idstringSubscription unique identifier.false
namestringName of the Subscription you want to create.true
descriptionstringA description for the Subscription.false
recurrencestringRecurrence of the Subscription charge. The following values ​​are available:
- week (weekly charge)
- month (monthly charge)
- bimonth (charge every two months)
- quarter (quarterly charge)
- semester (semester charge)
- year (year charge)
- custom (personalized charge. If you choose this option you must send in the custom_recurrence_amount attribute how often do you want to charge the subscription)
true
custom_recurrence_amountnumberSpecify how often you want to charge the subscription in case you choose custom recurrence (in days).false
cumulative_debtbooleanIn this field you can define if you want future installments to continue to be created in case of having any debt. It is false by default, that is, if an installment cannot be charged for a subscription_buyer to this Subscription, the next one will not be generated. If this attribute is true, the installments will be generated automatically regardless of any debt, which would accumulate.false
start_atdatetimeIf you want to start charging in a specific date (in ISO 8601 format). If not, the first charge will be when a customer register for the Subscription.false
periodsnumberIf you want to charge x number of times for the Subscription.false
expiration_timedatetimeYou can define a date for stop accepting inscriptions to the Subscription (in ISO 8601 format).false
dopnumberYou can define a scpecific day of payment for all the customers that are subscribed to the Subscription. If not, the day of payment depends on the day each customer register to the Subscription.false
has_apportionbooleanIf you want the Subscription to be charged on a prorated basis (default false).false
success_urlstringA URL to redirect your clients when the payment of the Subscription is successful.false
failure_urlstringA URL to redirect your clients when the payment of the Subscription fails.false
statusstringThe status of the Subscription. It can be "active" (default) or "inactive".false
imagefileAn image for the Subscription.false
extra_fieldsarray of jsonExtra fields that your customers can fill out when buying or registering to the Subscription (Independent of these extra fields, the email and the name are always requested). The json has scpecific values:
- question (string): The name of the extra field.
- mandatory (boolean): If the extra field is mandatory to answer (default false).
false
external_idstringAn external id to identify the Subscription.false