Advanced Scheduling Rules
The Subscribe Pro API (and also the Merchant App) allow definition of Advanced Scheduling Rules and assignment of those rules to products in the catalog.
Types of Advanced Scheduling Rules
There are a number of different rule types:
Basic | basic | Similar to standard frequency/interval, define frequency as a set number of periods, but with a bit of flexibility in how the periods roll over. |
Day of the X | day_of_the_x | Flexible rule type which can be used to define rules like "Every 3rd Tuesday of the Month", "Every 10th Day of the Quarter" or "Every Monday" |
Every N Periods | every_n_periods | Dynamically configurable (on each individual subscription item) number of periods. For example, configure an Every N Days rule, then customer chooses the number of days on the front-end of website. |
Rule Type - Every N Periods
API Fields
To handle the Every N Periods rule type, the subscription
API resource supports a field called scheduling_rule_params
. The field should receive JSON content such as the following:
{
"num_periods": 2
}
See: https://platform.subscribepro.com/docs/rest#post--services-v2-subscription.{_format}
Example Advanced Scheduling Rules
Rule type: day_of_the_x
day_of_the_x
rules allow you to create a schedules like "Every 3rd Tuesday" or "Every 15th of the Month".
For example, a rule that ships every 15th of every month:
{
"day_of_the_x": {
// Keyed by the rule type
"period": "month", // "quarter" or "month" or "week"
"which_day_type": "day", // "day", "month_and_day", "week_and_day", "month_week_and_day"
"num_periods": 1, // Every n periods
"which_day": {
"day": 15 // Day of period
},
"new_threshold_days": 3 // If cur day within n days of next renewal day, then skip a period
}
}
2nd Wednesday of every other Month:
{
"day_of_the_x": {
"period": "month",
"which_day_type": "week_and_day",
"num_periods": 2,
"which_day": {
"week": 2,
"day": 4
},
"new_threshold_days": 3
}
}
15th of the 2nd month of every quarter:
{
"day_of_the_x": {
"period": "month",
"which_day_type": "month_and_day",
"num_periods": 1,
"which_day": {
"month": 2,
"day": 15
},
"new_threshold_days": 7
}
}
Rule type: every_n_periods
every_n_periods
rules let you create schedules where the number of period is configurable by the customer. For example, you can give the customer the ability to choose the number of days in the My Account section of your website, like this:
Every N days:
{
"every_n_periods": {
"period": "day"
}
}
Every N months:
{
"every_n_periods": {
"period": "month",
// What happens when same day of month is not available for the next month?
// - Go "roll_month_back" or "roll_month_forward"
"monthly_roll_over_strategy": "roll_month_back",
"min_num_periods": 1, // Min number of periods
"max_num_periods": 99 // Max number of periods (0 = no maximum)
}
}
Rule type: basic
basic
rules are similar to our basic interval-based scheduling, but offer a few more subtle configuration options, such as monthly_roll_over_strategy
.
Every 2 Months
{
"basic": {
"period": "month",
"num_periods": 2,
// What happens when same day of month is not available for the next month?
// - Go "roll_month_back" or "roll_month_forward"
"monthly_roll_over_strategy": "roll_month_back"
}
}