#dopeboyz

1 messages · Page 1 of 1 (latest)

sleek pecanBOT
ocean meteor
#

hello! can you elaborate more on what's not working the same?

restive ore
#

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

ocean meteor
#

alright, how does it behave differently when you do it via the API?

restive ore
#

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

ocean meteor
#

at a high level, what you'd need to do is to :

  1. create a schedule from an existing Subscription : https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#existing-subscription
  2. 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

Learn how to use subscription schedules.

restive ore
#

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

ocean meteor
restive ore
#

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?

ocean meteor
#

what have you tried? can you share your code?

restive ore
#

Alright I'll share in a bit

#

Please don't close this threat will share code with you

restive ore
#

@ocean meteor

ocean meteor
#

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

restive ore
#

This is what i am getting

#

When i try to create new schedule it throws me this error

slow smelt
#

Hi @restive ore I'm taking over

restive ore
#

hey Jack please look into this issue i am having

slow smelt
#

Sure. As the error message explains, the subscription has already attached to a schedule, therefore you can't create another schedule for this subscription.

restive ore
#

So how do i remove it

#

Coz suppose a user downgrade from $50 to $30 so i want it to schedule update the subscription.

slow smelt
restive ore
#

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?

slow smelt
restive ore
#

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

slow smelt
#

It's not a button, it's just a badge that indicates that this subscription has schedule to update it.

restive ore
#

Yeah my bad but it's not showing when i schedule it through api