Changing subscription order ids

Good afternoon,

The subscriptions in my platform depend on item quantity (eg. the customer subscribes to receive X books each month). The customer may want to increase or reduce this quantity, hence the subscription must be updated to charge for the new amount.

I’ve tried changing the order template IDs using the swap_plan endpoint in the Subscriptions API, but it throws the following error:
{‘code’: ‘BAD_REQUEST’, ‘detail’: ‘New plan is the same as current plan’, ‘category’: ‘INVALID_REQUEST_ERROR’}

And if I don’t specify the new_plan_variation_id, it throws:
{‘code’: ‘BAD_REQUEST’, ‘detail’: ‘new_plan_variation_id cannot be empty.’, ‘category’: ‘INVALID_REQUEST_ERROR’}

The plan variation should not change as the cadence and phases should remain the same.

How can I approach this?
Would it work if I just change the order template using the Orders API?

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Use Item Options to Manage Item Variations
Orders API: How It Works
Create Orders

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

To update the quantity of a subscription, you should use the UpdateSubscription endpoint of the Subscriptions API. In the request body, you can specify the new quantity in the “quantity” field. This will update the subscription to charge for the new quantity.

However, please note that you cannot change the order template using the Orders API for a subscription that has already been created. The order template is used to generate the order for each billing cycle of the subscription, and once the subscription is created, the order template cannot be modified.

If you need to make changes to the order template, you would need to cancel the current subscription and create a new one with the updated order template.

This answer was reviewed by @Bryan-Square.

There doesn’t seem to be a “quantity” field in the UpdateSubscription endpoint

Thanks for sharing this.

Thanks for sharing this..