#wiiim
1 messages · Page 1 of 1 (latest)
So first of all what I'm trying to do:
Pretend there is a user with an existing subscription with a price of 50€ always billed on the first of the month with the help of a billing anchor.
In the middle of the month, I decide to give the user a new discounted price of 25€ per month. What I want to happen is that the next invoices will be 25€.
But after doing some tests I think stripe calculates the price for the new invoice differently (somehow taking into account the rest of the month)?
This is my tested subscription: https://dashboard.stripe.com/test/subscriptions/sub_1Ng5SaBedPgr0Zv28cF2apHj
Initially it had a price of 22.05€ and I wanted to change it to 9.80€ but Stripe set the next invoice to be 4.09€ because of some "corrections"?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yeah you are talking about proration
So basically what you want to do instead is update the Subscription to the new Price that you want but set proration_behavior: none
Im currently not updating the subscription at all. I just create a new price and update the item in the subscription.
How can I combine it into one request to be able to set the proration_behavior?
Oh, do I need to remove the item first and re-add it then?
Updating the Subscription Item does update the Subscription
So yeah you can set proration_behavior with that API as well: https://stripe.com/docs/api/subscription_items/update#update_subscription_item-proration_behavior
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Okay didn't knew that, will test it out. Thanks 🙂
Works as expected. Can be closed 🙂
🎉
Quick question again. How would I do the same thing for subscription schedules? There I would have to re-add the phase right?
Yeah with Subscription Schedules you always pass the current phase as phase 0
Okay and how would I replace the current phase? In the Java SDK I can only find "add" methods
Have you taken a look at https://stripe.com/docs/billing/subscriptions/subscription-schedules#updating ?
Not yet. So i have to cancel the old phase and add the new one or can I just set the price on the old phase?
You don't really cancel anything. Whatever period is currently happening on the Subscription you pass as Phase 0. Then Phase 1 is your update
So if you wanted to update a Sub immediately that is on a Sub Schedule you would set end_date: now for phase 0 (the current period of the Sub)
Then indicate your update in Phase 1