#Pavan-subs
1 messages · Page 1 of 1 (latest)
hello @mighty crown, could you elaborate a bit more on what you mean by different proration behaviour - is there some unexpected behaviour?
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 ?
there's two ways to go about it :
- you can set the current subscription to
cancel_at_period_end=true[0] and schedule a new subscription with a new quantity to begin when the old subscription ends [1] - Or, you can create a subscription schedule from the existing subscription : https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-from_subscription and then update the quantity in another phase
[0] https://stripe.com/docs/api/subscriptions/update#update_subscription-cancel_at_period_end
[1] https://stripe.com/docs/billing/subscriptions/subscription-schedules
Thanks. But what is difference between these 2 approaches ?
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
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
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
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 ?
yep
Will the payment methods from existing subscription goes to new subscription if we schedule a subscription. No need to update anything right
which option are you using? option 1 or option 2?
If option2 does that job, i will go with that.
yeah, option 2 would be easier in that sense, since you're only updating the quantity
But in the option2, how to update quantities, i am not able to see in SubscriptionScheduleUpdateParams
i'm not that familiar with java but i think this is what you're probably looking for : https://stripe.dev/stripe-java/com/stripe/param/SubscriptionScheduleUpdateParams.Phase.Item.html
Any example to update scheduled subscription i can refer, this is becoming very complex
?
let me see if i can put something together, i'll get back to you in a bit
@gleaming oasis I am waiting on this. Thanks in advance
sorry, i'm tied up with something else at the moment, i'll respond in this thread when i have a sample
@mighty crown you can try the attached, the code snippet is too long to reply in discord, so attaching as a text file