Work with Subscriptions
Using the API, it is possible to transfer data of products having the automatic renewal option.
How It works
- The original product must be pre-configured.
- Additional parameters (products.[object].subscription) that identify a product with auto-renewal and set subscription settings must be transferred in the request to the API. If the parameter has not been transferred, the auto-renewal option will not be available for the product in the cart on the checkout page (even if the auto-renewal option has been preset for the original product)
- Further, as in the standard operating procedure, a checkout link returns in response. The customer clicks on it and gets redirected to the checkout page where they can place an order.
- An auto-renewal consent flag is displayed on the checkout page for the product. Using the flag, the customer can confirm his consent to the subscription.
- If the customer gives consent and chooses an appropriate payment method for their order having auto-renewal supported, then after the order is paid for, the Subscription is created.
- The order that initiates the subscription creation is the parent one.
- All the orders created automatically to renew the subscription are child orders.
- Further operation of the Subscription is carried out according to the standard operating procedure, except for some specifics.
Following the standard procedure along:
- Shortly before the subscription validity period expires, a child order is created automatically to renew the subscription.
- The child order created is paid for automatically (money is debited from the payment method account that is used for the parent order).
Product Validity Period (Term)
Product validity period is transferred differently for parent and child orders:
- For the parent order - the product validity period is transferred in the request to the API (products.[object].subscription.period).
This allows setting a different validity period for the same product in each request.
- For the child order - the product validity period is transferred from the original product settings and is the same for all dynamic products created on this original product basis.
It is possible to change the subscription expiration date of each particular Subscription using the individual Subscriptions API.
Renewal price per product item is transferred in the request to the API (products.[object].subscription.price) and is then used throughout the life of the Subscription. It means that each child order will have the same renewal price.
When calculating a renewal price:
- The price will be multiplied by the number of product items, the same number of which the parent product has.
- The VAT amount can be added, according to the same rules applicable to the price in the cart.
- If a discount for the parent product is transferred in the request, then it will not be applied for renewal.
Renewal prices can be changed through the individual Subscriptions API.
You transferred in the request:
- Product price (products.[object].price) = 1200,
- Product quantity (products.[object].quantity) = 2,
- Discount (products.[object].discount_percent) = 10,
- Renewal price (products.[object].subscription.price) = 900.
In total, the final product price in the cart will be 1200 х 2 х 0.9 = 2 160.
The renewal price will be calculated as: [product price] х [product quantity] = 900 х 2 = 1 800.
Renewal Product Name
Renewal product name is transferred in the request to the API (products.[object].subscription.name). It is further used throughout the life of the Subscription. It means that each child order will have the same renewal product name.
Names can be changed through the individual Subscriptions API.
If the request did not contain a renewal product name and/or a renewal price, then this data will be identified from the renewal product that is linked to the original product.
How to Remove Auto-Renewal for Products
If you want the auto-renewal option to be unavailablea for a dynamic product, do not transfer products.[object].subscription in the request sent for generating a checkout link.
If there is a need in child order creation testing:
- You can contact the support, to initiate child order creation for a subscription order. During processing, the license validity period of the parent product will be recalculated and the child order will be created immediately.
- You can also perform testing on your own, e.g., by inputting a minimum product validity period for a parent product (6 days by default). In this case, a child order will be created automatically on the next day after the parent order is payed for. If you set a lesser period, then no child order will be created.
- Please note: Subscriptions are created only when the customer gives their consent to it when placing a parent order, and after this parent order is paid for.