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:

BasicbasicSimilar 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 Xday_of_the_xFlexible 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 Periodsevery_n_periodsDynamically 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 data. 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
  }
}

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"
  }
}

Basic:

{
  "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"
  }
}