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:
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:
Additional notes
Updating the subscription model
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:
More to read
Last updated