Selecting the source order
How to set the subscription first run and add the line items from which to generate the subscriptions
Last updated
How to set the subscription first run and add the line items from which to generate the subscriptions
Last updated
You have associated a subscription model with your market, setting the allowed subscription frequencies and choosing the subscription strategy. Now you want to create the source order from which the subscription will be generated, add a customer payment source, and place it.
Subscriptions can be automatically generated from orders that contain at least one line item that has a frequency defined. The source order is considered the subscription's first run and the recurring target orders that are created are scheduled on it for placement, according to the related frequency.
The frequency of the source order's line items must be among the ones allowed by the market's subscription model. You can specify a frequency for line items of type skus
, bundles
, and adjustments
only.
As a sales channel, first you need to check which those allowed frequencies are so that you can show them to the user for selection. To do that, send a GET
request to the /api/subscription_models/:id
, requesting the frequencies
.
For the steps you need to follow to create a new order and add line items to it please refer to our Shopping cart guide:
For the steps you need to follow to prepare your order for placement (e.g. adding the customer addresses, shipping methods, etc.) and place it please refer to our Checkout guide:
Except for the case of wire transfers, automatic target order placement can be successful only if the source order comes with a payment source saved in the customer wallet, so that the source order's customer payment source can be copied.
If you're using our hosted Checkout application most of all of the steps above come out of the box!
The following request fetches the frequencies allowed by the subscription model identified by the "AavWRUbbMQ" ID:
The following request adds the SKU identified by the "RAZRFILLPACK4" code to the order identified by the "NgojhelVGm" ID, setting a weekly frequency for the line item:
The process of automatic order subscription generation doesn't transfer to the target orders or re-compute promotions or gift cards applied to the source order. That means that you can apply promotions to the source order only but not to the automatically generated recurring target orders (e.g. offering the first occurrence for free and letting the customer pay starting from the second one).
To offer a discount based on the subscription frequency you can set some price frequency tiers. In this case, the price of the source order's line items that have a frequency is set by the tier the related frequency falls within.
Please note that any changes to an existing price tier don't affect the already generated order subscription items (unless you nullify the related order subscription item price). The changes will apply starting from the next subscription generation only.
Once triggered the subscription generation from a source order, that order cannot be reused, even if some changes that could lead to the generation of different subscriptions (e.g. at the subscription model or price tiers level) occurred in the meantime. You need to create a new identical order and trigger the new subscription generation from it.
If the source order is cancelled the already generated order subscriptions keep running, unless differently specified at the subscription model level by setting the auto_cancel
attribute to true
.
When adding a line item with frequency to an order, you can still leverage the _update_quantity
trigger attribute as explained here. Just make sure use it to update the quantity of an existing line item with the same frequency.
The update of the quantity has priority over the frequency assignment (i.e. if you try to add a line item with an SKU code already present in the order but with a different frequency and set the _update_quantity
attribute to true
, no additional line item will be created, the quantity of the existing one will be updated, keeping its original frequency.
See our API reference if you need more information on how to or , , or about how work.