Introduction
The Subscriptions module allows you to set up regular payments from users for a fixed set of products in your project. A subscription consists of a set of products and a period — every N days, the cost, calculated as the sum of the prices of the included products, is automatically (or manually) deducted from the user.
The module consists of two main parts:
- The "Subscriptions" module in the left menu — a catalog of all subscriptions in the project. Here you create, edit, and delete subscriptions, configure their payment account, period, and product composition. More details can be found in the subscriptions settings section.
- The "Subscriptions" tab in the user card — a list of subscriptions for a specific user with statuses, expiration dates, and manual actions (for
customtype subscriptions). More details can be found in the user subscriptions section.
Working with subscriptions from the client application is done through the API. More details can be found in the subscriptions API section.
How the Subscription Works
When creating a subscription in the admin panel, you select:
- Payment account — determines how the payment will be processed. More about account types can be found in the payment accounts section.
- Period in days — how often the user needs to make a payment to renew the subscription.
- List of products included in the subscription — the total cost of the subscription is calculated from their current prices.
When a user subscribes through the API, the system:
- Creates a record of the subscription for the user.
- Returns a payment link (for
stripeandmidtrans) or immediately activates the subscription for thecustomtype. - At the end of the period, automatically deducts the next payment (
stripe,midtrans) or waits for manual renewal (custom).
Supported Payment Accounts
You can connect one of the following types of payment accounts to the subscription:
- Stripe — automatic periodic deductions through Stripe. After creating a subscription, the API returns a link for the initial payment.
- Midtrans — automatic periodic deductions through Midtrans. Similar to Stripe, it returns a payment link.
- Custom — manual subscription. Deductions are not made automatically; renewal and cancellation are performed by the administrator from the user card.
The type of payment account determines what actions are available for the subscription and whether it can be canceled through the API. Custom subscriptions can only be canceled through the admin panel — in the user section.
Price Dynamics
The cost of the subscription is calculated as the sum of the prices of the products included in it. If you change the price of one of the products, active subscriptions will automatically recalculate their cost — the new value will be applied starting from the next billing period.
The current period is always paid at the price that was in effect at the time it began. This allows you to change the composition and prices of products without disrupting already paid periods for the user.