#alvin_63959

1 messages · Page 1 of 1 (latest)

winged plinthBOT
wheat warren
#

Is the upgrade immediate? OR are you scheduling it in some way?

#

ah you said end of the period

slate valley
#

this is a downgrade by the way

#

downgrade at the end of the period

#

but I want to cancel that in the middle of the subscription

wheat warren
#

ah okay, meant to say "update" but typed upgrade

#

my bad

#

how are you handling the end of the period subscription downgrade/update?
Are you using subscription schedules? OR are you just calling the subscription API directly?

slate valley
#

for downgrade specifically I am doing this
options = new SubscriptionUpdateOptions
{
Items = items,
DefaultTaxRates = new List<string>
{
ConfigurationManager.AppSettings["StripeTaxRate"],
},
ProrationBehavior = "none"
};

then
service.Update(AccountSubscription.StripeSubscriptionID, options);

update the subscription plan

#

so in the next billing period it will reflect the new price of downgraded plan.

wheat warren
#

Gotcha. I think you'd likely want to switch to using a subscription schedule instead
That would allow you to cancel the "update"

https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#downgrading-subscriptions

You can create "phases" for the state you want the subscription to transition through
So for example,

current product/price would be phase 1
downgraded product/price would be phase 2

if you want to cancel the downgrade, you can just update the phases to stop/modify the transition

slate valley
#

okay so say when I want to downgrade create subscription schedule create options then add 2 phases is it?

then say if I cancel that phase 2, what will happen for the phase 1? or schedule subscription? should I just call the cancel schedule api?

wheat warren
#

The phase 1 is really the current phase (so the current price), each phase has a start date and end date

When you want to downgrade, you can set phase 1 end time and phase 2 start time as end of your billing cycle period

When you want to cancel the downgrade, you can update phase 1 end time or just release the subscription from the schedule, which means it will continue with the current price

slate valley
#

I see okay, that pretty much explains everything.

#

I have another query

wheat warren
#

Sure,

slate valley
#

Say you want to downgrade again right then your card failed for the payment, I already updated the subscription so we can have an invoice sent to customer so if the payment failed how to like revert the subscription back to its original state?

wheat warren
#

^That's what you'd ideally use

but since you're setting proration_behavior to none , it won't generate a new invoice.. So I'm unsure how you could handle this.

#

and mixing that with subscription schedules, it gets even more complex

#

I think you'd just need to listen to webhook events for payment failures, check if the subscription was "updated" and then update it again to undo the previous update

slate valley
#

Okay I see, I will try all these suggestions. Thanks for your help hanzo! Appreciated it!