#Pavan-subs

1 messages · Page 1 of 1 (latest)

gleaming oasis
#

hello @mighty crown, could you elaborate a bit more on what you mean by different proration behaviour - is there some unexpected behaviour?

mighty crown
#

My use case whenever i downgrade quantities it should always happen at the end of billing period not immediately

#

While passing Subscription update params i have passed different proration behaviour options like None, Create_prorations etc.

#

How to achieve above use case ?

gleaming oasis
#

there's two ways to go about it :

[0] https://stripe.com/docs/api/subscriptions/update#update_subscription-cancel_at_period_end
[1] https://stripe.com/docs/billing/subscriptions/subscription-schedules

mighty crown
#

Thanks. But what is difference between these 2 approaches ?

gleaming oasis
#

it's entirely up to you which you prefer to use

#

there's no real difference other than how you implement it

#

hmmm, maybe the one difference i can think of is that for the first one, you'd end up with a new subscription when you update the quantity because you're cancelling the old subscription and creating a new subscription

mighty crown
#

In the first one also we need to update after creating scheduled subscription right ?

#

I would like to achieve atomic implementation

#

If one step fails it should rollback

gleaming oasis
#

if you're saying that you need to update the cancel_at_billing_end after creating the schedule subscription - you can do it either before or after you create the subscription schedule

#

if you want to achieve atomicity, then you'd have to implement the "rollback" yourself

mighty crown
#

Ok. you can create a subscription schedule from the existing subscription - > In this also first scheduled subscription will be created and then we have to update the quantities right ?

gleaming oasis
#

yep

mighty crown
#

Will the payment methods from existing subscription goes to new subscription if we schedule a subscription. No need to update anything right

gleaming oasis
#

which option are you using? option 1 or option 2?

mighty crown
#

If option2 does that job, i will go with that.

gleaming oasis
#

yeah, option 2 would be easier in that sense, since you're only updating the quantity

mighty crown
#

But in the option2, how to update quantities, i am not able to see in SubscriptionScheduleUpdateParams

mighty crown
#

Any example to update scheduled subscription i can refer, this is becoming very complex

#

?

gleaming oasis
#

let me see if i can put something together, i'll get back to you in a bit

mighty crown
#

ok Thanks.

#

Mine is simple use case update quantities of scheduled subscription

mighty crown
#

@gleaming oasis I am waiting on this. Thanks in advance

gleaming oasis
#

sorry, i'm tied up with something else at the moment, i'll respond in this thread when i have a sample

gleaming oasis
#

@mighty crown you can try the attached, the code snippet is too long to reply in discord, so attaching as a text file