#Mathieu - sub quantity
1 messages · Page 1 of 1 (latest)
Hi there. One moment
You could always update the subscription immediately each time the customer updates their license and pass none for proration_behavior: https://stripe.com/docs/api/subscriptions/update#update_subscription-proration_behavior
i see but here is one scenario that maybe you can explain to me what will happen :
we also let our user choose to add more licence will there already are on a subscription
so with this example :
- Client A subscribe to 3 licences on July (it's a yearly subscription)
- He cancel 2 licences on December (call the api with proration_behavior none, no invoice is trigger at the moment its ok and it will prorate next invoice)
- Then on April next Year he add 1 licence to his subscription
=> What will append to his proration since when he add a licence we wanna instant trigger an invoice ? I assume it will prorate with 2 licences (3-2+1) ?
Instead what we want to see for his april upgrade is 4 licences for the generated invoice at that moment, then for the renewal invoice (on july next year) have some hooks to reduce his 4 licences down to 2 (cause he cancels 2 on december)
It's maybe weird but that how we would like to communicate to our client. Does it make sence ?
Gotcha. There's no hook that you'd be able to use for this unfortunately. The only webhook event we send right before a subscription is charged for the next billing cycle is invoice.created, but at that point, the new billing cycle is considered started and updates made to the subscription aren't propagated to that draft invoice that's created
You could try to schedule some update in your system
I am trying to think of how you can do that but I am still a bit unclear on what you want the behavior to be in this scenario. So on downgrades you want to wait until the end of the subscription cycle but for upgrades you want to bill for the new price instantly?
@fervent lion yes exactly
the invoice proration on upgrade is already done we just need to finish the downgrade on subscription cycle
so i'm looking for the easiest / best suited method for this case or alternate method that are not to far from this scenario
How are you currently doing upgrades at the moment? Is it one of our standard prorations or are you immediately charging for a new month or something?
For upgrade it's a normal api subscription update call with proration_behavior always_invoice and we achieve to target the correct subscription item quantity to update (according what the user choose)
Gotcha. Checking in to how you can do the downgrade
ok thanks for your time guys !
So it looks like the standard proration won't really work here. In my tests when I had a subscription go from 2 -> 1 -> 3 quantity in a month, that last update would only credit the user as if they had been at 1 quantity the whole month.
One thing that may help you here is creating a subscription schedule that changes the quantity down at the end of the month https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#increasing-quantity
Schedules can make it more complicated if the user tries to upgrade and downgrade multiple times a month but that logic will get a bit sticky with any of our products.
If you want to track it on your side, you could also just wait for the invoice.upcoming event and make update calls to your subscription from here.
that sound promising we will try that and do some testing with the schedules api and will come back to you if we have any issue,
thanks again 😉
could you please just tell me which doc to see to better understand invoice status for the subscription cycle ?
The two docs that I like to point to for that are "how invoices work" and "how subscriptions work"
https://stripe.com/docs/invoicing/overview
https://stripe.com/docs/billing/subscriptions/overview
Is there a particular question that you have about that cycle at the moment?
it would be about more understanding from the timing of invoice.upcoming and we it pass to draft (if i'm right ?)
@wild fog not sure I understand your question sorry
My question is about the invoice.upcoming event and the configuration of the timing of the event, from the dashboard i saw that we can select between 3, 7 and more days.
Does this option can be configure from the api ? Like for our case reduce it to one day ?
And what would be the status of the Invoice object sent by the invoice.upcoming event ?
no we don't have a way to configure it via the API today
and the invoice would be in draft
ok and while the invoice is in this status we can still update quantity but as soon as it goes from draft to invoice.finalized event we will not be able to update quantity at that point, am i correct ?
and from the event invoice.finalized the invoice will have the "open" status, if i'm right ?
no that's not correct
the upcoming invoice is just an "FYI". It doesn't really exist.
And you can't change the quantity of an invoice associated with a subscription either, so that can't work
alright i think i get it now, when we get the invoice.upcoming event there is no real invoice "yet" it's just a FYI event but we can, at this point, from our backend trigger some subscription update (with proration_behavior none) to update the subscription quantity for the "real" invoice that will be created on "open" status which, at this point, cannot be updated anymore
yes!
ok it's more clear now thanks, i still wonder how the subscription will behave in such scenario if the user does some upgrade on his own during that timeframe (after our update call with proration_behavior none and before the actual invoice renewal cycle) but i will find out with some test
yeah that's the downside of making the update then. Alternatively you can use the SubscriptionSchedules API to plan the future quantity change: https://stripe.com/docs/billing/subscriptions/subscription-schedules