#dopeboyz
1 messages · Page 1 of 1 (latest)
hello! can you elaborate more on what's not working the same?
Okay im trying to downgrade a subscription and wants to downgrade it with scheduled update
So when a user tries to downgrade from premium plan to basic plan in our case we want the basic plan to start at the end of period end and the way i do it from dashboard is to update the subscription and the schedule update it
alright, how does it behave differently when you do it via the API?
Im not sure how i do it with api
Im currently updating the subscription but i don't see any keys to schedule it
And i have tried using subscriptionSchedule api too but no luck
at a high level, what you'd need to do is to :
- create a schedule from an existing Subscription : https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#existing-subscription
- update the schedule from step 1 for the downgrade. Note that you need to include the current phase as well. There's an example here, but you would want to update the schedule and not create it : https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#downgrading-subscriptions
I want that update scheduled flag you can see
I tried following instructions to create a scheduled Subscription but when i update the scheduled Subscription it gives me an error that you cannot migrate a subscription that is already attached to a schedule
if it already has a Schedule, then you retrieve the Subscription : https://stripe.com/docs/api/subscriptions/retrieve, the returned object will have a schedule id : https://stripe.com/docs/api/subscriptions/object#subscription_object-schedule, you can update it
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So if i had to downgrade from $50 to $30 plan, how'd i do it with scheduled Update so the next invoice should be $30, could you please explain a little more. I have created the scheduled Subscription but how to i update the subscription 50 to 30?
what have you tried? can you share your code?
i'm assuming that you're hitting the first issue whereby you can't create another Schedule for a Subscription that already has a Schedule attached.
like i mentioned, retrieve the Subscription, and check if it has a Schedule first
This is what i am getting
When i try to create new schedule it throws me this error
Hi @restive ore I'm taking over
hey Jack please look into this issue i am having
Sure. As the error message explains, the subscription has already attached to a schedule, therefore you can't create another schedule for this subscription.
So how do i remove it
Coz suppose a user downgrade from $50 to $30 so i want it to schedule update the subscription.
If you want to create a new schedule on the same subscription, you need to release it first (https://stripe.com/docs/api/subscription_schedules/release#release_subscription_schedule)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
And if user decides again to go from $30->$10 plan so how do i cancel the previous scheduled Subscription and start a new schedule with new price?
You can update the subscription directly (https://stripe.com/docs/billing/subscriptions/upgrade-downgrade)
If you really want to cancel the subscription, you can also do it through (https://stripe.com/docs/api/subscriptions/cancel#cancel_subscription)
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 I'll implement this
But when i start the schedule why don't it show that grey out button inside stripe dashboard
But i manually schedule update subscription from dashboard it shows that subscription scheduled button
It's not a button, it's just a badge that indicates that this subscription has schedule to update it.
Yeah my bad but it's not showing when i schedule it through api