How to set up subscription-based products and plan groups

Subscription-based product is a service or a set of services provided to a user when they purchase the subscription. Product creation is necessary if you set up the sale of separate subscriptions for different services or if you want to give a user the ability to get several subscriptions at the same time. An example of a subscription-based product access to the streamer’s channel, to the game, or to a unique item/unique ability.

Note
If you want to sell game access with only one subscription option, you need to set up a subscription plan but you do not need to configure the product.
A group of plans is a set of plans that have the same group_id parameter value. The group_id parameter is used to form a group of plans and associate this group with subscription-based products. Creating a group of plans allows you to:
  • limit the number of plans you can choose to subscribe to a product
  • let the user switch to another plan inside the group
Note
By default, plans are created with the “group_id”:null parameter and included in the general group. You can choose not to create groups if no products are created in your project.
Groups, plans and products interact with each other according to the following rules:
  • One plan can belong only to one group.
  • One product can be created based on only one group.
  • One group can be linked to several products.

To create a subscription-based product and plan group, pass the following parameters to the Create Product API call:

  • name with the name of the product
  • group_id with the name of the plan group
Note
You can also create a group by passing the group_id parameter to the Create Plan or Update Plan API calls, and then create a product using the existing group_id value.
To change, delete, or get a list of all products, use the corresponding API calls:

To link a plan to a plan group and to a product, pass the group_id parameter with the name of the plan group to the Update plan API call. To remove a group, pass “group_id”:null.

To open the payment interface when purchasing a plan linked to a product, pass the following parameters to the Create token API call:

  • purchase.subscription.plan_id with plan ID
  • purchase.subscription.product_id with the ID of the product associated with the plan via group_id

Examples
  • If you want to sell game access with only one subscription option, you need to set up a subscription plan but you do not need to configure the product.
  • If you want to sell access to the game for different terms, for example, for 1 and 3 months, you need to set up 2 subscription plans with the appropriate conditions. You do not need to configure the product either. Plans will have the “group_id”:null parameter by default, that is, they will be in the general group. The user will be able to choose any of them when purchasing a subscription, as well as switch from one plan to another.
  • You want to sell not only access to the game for 1 and 3 months, but also an additional subscription, for example, a sword upgrade for 6 months. In this case:
    1. Create 2 products “game” and “sword” by passing unique name and group_id parameters for each product to the Create Product API call.
    2. Create plans for 1, 3 and 6 months in one of the following ways:
      • Set up the plans in your Publisher Account, then use the Update plan API call to pass the product group_id parameter “game” to the subscription plans for selling the game and the product group_id parameter “sword” to the subscription plans for selling the sword.
      • Use the Create Plan API call, where you pass the data about the plans, as well as the group_id parameter of the “game” product to the subscription plans for selling the game, and the group_id parameter of the “sword” product to the subscription plans for selling the sword.
    3. Implement the display of “game subscription” and “sword upgrade subscription” products in the store interface.
Note
When implementing the interface, please note that the object of sale is not the subscription itself, but the product created in the project since the subscription is a combination of the product and the selected plan resulting from the purchase.
Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Last updated: July 31, 2024

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!