Update a STRIPE Subscription

Hi there! Have you already built calls to update a Subscription from Stripe?

I need help while updating the quantity of items on a subscription already running, prorating it. I was able to get the /v1/subscription_items/[si_id]/ to adjust the total amount and quantity itself, but it did not charge the payment, nor change the next invoice date on Stripe.

Practical example: User obtained an annual subscription on January 1 and now wants to add 2 family members to it. I can adjust the quantity to 3, but I need to charge again, prorating it to give a discount for the one he has already paid (minus the months he has used until now).

I’ve tried the call to /v1/subscription_items/[si_id]/, the preview from /v1/invoices/create_preview, the common one to /v1/subscriptions/[subscription]/, and several others I’ve deleted already. Even their AI gets me advice on endpoints that are no longer there (like /invoices/upcoming/).

*Please feel free to include a donate link. I would gladly grab a cofffee/beers with you to get past this issue

You are on the right track. You can call the create_preview endpoint to show the user what the prorated charges will be. To update the subscription you call /v1/subscription_items/[si_id]/.

Depending on how you want the proration to be done:

  • Update the proration_behavior
  • Update the billing_cycle_anchor

E.g. to charge the user immediately and prorate without changing their December 31 billing cycle (for an annual sub starting Jan 1):

  • set proration_behavior to always_invoice
  • set billing cycle anchor to unchanged

Read more:

1 Like

Thank you @nick23! I forgot to update yesterday.
Basically I only used the /v1/subscription_items/[si_id]/ with proration_behavior. The billing_cycle_anchor seems to be set unchanged by default.

The goal was actually to prorate the other way around, but this works great for now.

BUT, nonetheless, your reply is absolutely complete and the perfect solution for this thread.

1 Like