#Mathieu - sub quantity

1 messages · Page 1 of 1 (latest)

crystal hazel
#

Hi there. One moment

wild fog
#

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 ?

crystal hazel
#

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

fervent lion
#

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?

wild fog
#

@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

fervent lion
#

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?

wild fog
#

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)

fervent lion
#

Gotcha. Checking in to how you can do the downgrade

wild fog
#

ok thanks for your time guys !

fervent lion
#

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.

wild fog
#

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 ?

fervent lion
#

Is there a particular question that you have about that cycle at the moment?

wild fog
#

it would be about more understanding from the timing of invoice.upcoming and we it pass to draft (if i'm right ?)

wispy tiger
#

@wild fog not sure I understand your question sorry

wild fog
#

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 ?

wispy tiger
#

no we don't have a way to configure it via the API today

#

and the invoice would be in draft

wild fog
#

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 ?

wispy tiger
#

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

wild fog
#

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

wispy tiger
#

yes!

wild fog
#

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

wispy tiger