Configuring a subscription model
How to create a subscription model to set the available subscription frequencies and the subscription strategy for a market
Problem
It's time to start providing subscription features in one of your Commerce Layer markets. You want to define the available subscription frequencies for the market in question and set the subscription strategy based on which the necessary order subscriptions will be automatically generated.
Solution
You need to create and configure a subscription model and associate it with your market. To do that:
Send a
POST
request to the/api/subscription_models
endpoint, setting thefrequencies
andstrategy
attributes.Send a
PATCH
request to the/api/markets/:id
endpoint, setting thesubscription_model
relationship.
Example
1. Create a new subscription model
The following request creates a new subscription model that allows five subscription frequencies:
To create a new subscription model you need an integration token of type admin (or a custom role with the necessary permissions).
2. Associate the new subscription model with an existing market
The following request associates the subscription model identified by the "AavWRUbbMQ" ID with the market identified by the "bgOEQhznoZ" ID:
To update a market you need an integration token of type admin (or a custom role with the necessary permissions).
Additional notes
Updating the subscription model
Please note that any changes to an existing subscription model don't affect already generated subscriptions. The changes will apply starting from the next subscription generation only. If you try to update some of the already generated subscriptions in a way that's not consistent with the new changes to the subscription model you will receive a validation error.
Example
The following request updates the subscription model identified by the ID "AavWRUbbMQ", adding an additional allowed frequency and changing both the default subscription strategy and auto-activate / auto-cancel behavior:
To update a subscription model you need an integration token of type admin (or a custom role with the necessary permissions).
More to read
Last updated