Subscription Plan
The Subscription Plan allows you to prepare your subscription plans in an extensible and flexible way. A plan represents a provided service with specific price and optionally a Trial.
There are 2 different types of plans currently supported:
- Pre-paid (indicated by the flag
"prepaid": true
) - plans charged at the beginning of a period; - Post-paid (indicated by the flag
"prepaid": false
) - plans charged at the end of a period.
Every plan has a name and description which are mandatory, not unique properties.
A plan can have a trial period (combination of trialDurationUnit
and trialDurationPeriod
) and has a pre-defined billing cycle (combination of billingUnit
and billingOccurrence
).
Each plan has a set of "executions" or billing cycles (identified by billingCycles
property). Its purpose is to define how many times a customer will be charged.
In order to extend the plan with additional information a specific property merchantMetadata
is added. You can store any details you would like to use/track using this parameter.
The Subscription plan endpoint supports the following methods:
-
Create Subscription Plan
-
Update Subscription Plan
-
Get Subscription Plan
-
Get All Subscription Plans
-
Delete Subscription Plan
The Subscription plan APIs enables also the use of the below additional features such as the trial feature.
Trial feature
General Details
When a Trial is configured for a plan (Period & Unit), all the subscriptions created under this plan would have a trial period. The start date of the subscription then represents the start date of the trial. The trial end date would be calculated based on the trial Period & Unit provided (e.g., 14 days).
Having the trial feature active for a specific subscription reflects on defining the next billing date. If we are dealing with a pre-paid subscription, then the customer would be charged when the trial ends; the next billing date would be the trial end date. Otherwise if the subscription is post-paid, then at the end of the trial we start the billing cycle and the customer would be charged at the end of this cycle. This ensures that the subscriber in the post-paid scenario wouldn't be charged for the trial period.
How to activate, update or deactivate a Trial?
During the creation of a subscription plan and to activate the Trial, simply pass the desired values in the parameters trialDurationPeriod
& trialDurationUnit
to specify a trial period for all subscriptions created under this plan. The same could be applied by updating a plan and providing the new desired values on the same parameters: trialDurationPeriod
& trialDurationUnit
. The new trial details would be applied then on subscriptions created under this plan going forward without impacting or changing the previously created subscriptions. This is also applicable if the merchant wants to remove the trial details from a specific plan, you can simply update the trialDurationPeriod
& trialDurationUnit
parameters with "null" values, which means that future subscriptions created under this plan would have no trial period.