Swap Subscription Plan Variations

Applies to: Subscriptions API | Catalog API

Learn how to swap plan variations in a subscription using the Subscriptions API.

Link to section

Swap variations for one customer

In cases where a customer wants to switch one subscription type for another, such as upgrading to a new or premium subscription tier, you can swap the plan variation for a customer's subscription by using the SwapPlan endpoint.

In your request, include the subscription_id to update the path. In the request body, include the ID of the new plan variation as the new_plan_variation_id, as well as a list of phases containing an ordinal and an order_template_id corresponding to those in the new plan variation.

Swap plan

The response returns the current Subscription object containing a new SWAP_PLAN action. The customer remains subscribed to the original plan variation until the end of the current billing cycle, at which time the new plan variation replaces the original variation. If the customer is in the middle of a billing cycle and you want to subscribe them to a new plan variation effective immediately, you must cancel the current subscription and create a new subscription with the desired plan variation.

Link to section

Swap variations for multiple customers

Sometimes a seller might want to make changes to a plan variation and have them take effect for every subscriber (for example, increasing the price of a subscription tier or setting a consistent monthly_billing_anchor_date. In order to do so, your application must take the following actions:

  • Load details of the current plan variation using RetrieveCatalogObject.
  • Create a new CatalogSubscriptionPlanVariation using UpsertCatalogObject, keeping all details the same as the old variation except for what you want to change (such as the phases.subscription_pricing or monthly_billing_anchor_date field).
  • Take note of the id values for the original variation and the new one you just created.
  • Call BulkSwapPlan with the old_plan_variation_id and new_plan_variation_id sets. This swaps the subscriptions of every customer subscribed to the old plan variation. At the time of their next bill, each customer is automatically subscribed to the new plan variation.
  • (optional) If you no longer want any subscriptions to the original plan variation, deprecate the original variation by calling UpsertCatalogObject and setting present_at_all_locations to false. This effectively “deactivates” the plan variation, ensuring that no new subscriptions can be created. If you deactivate a plan variation in this way, set the successor_plan_variation_id to the id of the new plan variation that replaces it.

The following BulkSwapPlan request schedules a SWAP_PLAN action for all active subscriptions under one plan variation. At the end of each subscriber's billing cycle, they are subscribed to the new plan variation.

Bulk swap plan

The response shows the number of affected subscriptions.

{ "affected_subscriptions": 47 }