#Ganich - Subscription

1 messages ยท Page 1 of 1 (latest)

jagged flint
#

Okay well the basic practice would be to represent your annual subscription as a monthly subscription.

#

How do you currently handle proration?

#

And when you say merge all invoices, do you want to get paid monthly but invoice annually?

desert summit
desert summit
# jagged flint How do you currently handle proration?

So the basic idea is to create a proration when the quantity goes up. So say if I have 7 users on my subscription, a few weeks later I add a new one, I will update the subscription to 8 and create a proration (so at this point the customer is due to pay for this new user the rest of the period)

desert summit
jagged flint
#

Hmmm...okay

desert summit
#

I thought of trying to fetch all the open invoices of the customer and creating a new one by gathering all the invoice items from the open ones. Then delete the buffered invoices.

jagged flint
#

So this is per-seat metered billing?

#

Sorry for the delay, things got kinda busy for a sec

desert summit
#

No prob, yeah it's per seat

#

But not metered

#

Or maybe I'm confused as of how to use metered billing for this use case

#

I'm not sure metered is what I need, but perhaps it is

#

Because in my case, if a user is added during the year, it is due even if it's removed later on

jagged flint
#

Okay so the client adds 4 users two months in to their sub. Even if they remove 2 of them a few months later they get billed for all 4 for the remaining 10 months?

desert summit
#

Yes

#

That's exactly it

jagged flint
#

And when do you want them to receive the invoice?

desert summit
#

It'd great to be able to trigger it at any time. But if a solution exists to do it monthly that'll do

jagged flint
cursive compass
#

(rather than waiting to include the proration on the renewal)

desert summit
cursive compass
#

Yes that's right, so would depend on the behaviour you want

desert summit
cursive compass
#

if you just want to bill for the difference, then using always_invoice when updating might be better for you (but you should test this to see the actual behavious)

#

When do you want to invoice them, if not at the time of the upgrade and not waiting until the renewal?

desert summit
#

Ideally anytime, but the goal is to have a trigger every month or two

cursive compass
#

You can trigger an invoice for pending items on a subscription at your discretion, in that case

desert summit
#

Ow it looks exactly like what I just tried to do! The link of the "one-off" invoice is not explaining how to do it, do you have a link to the doc?
I just tried to do this:

  const mergedInvoice = await stripe.invoices.create({
    customer: subscription.customer,
    subscription: subscription.id,
  });

From what I read in the doc, it is supposed to do it but I get the following message:
Nothing to invoice for subscription

#

Despite having the following invoices:

cursive compass
#

Those existing invoices are unrelated, though, you're trying to create a new one

#

Did you update the quantity on the subscription first?

desert summit
#

Yeah those invoices have been created when adding a user and changing the quantity with payment_behavior set to default_incomplete

cursive compass
#

Can you share one of those request id?

#

I mean instead to just update the subscription quantity and change nothing else

#

this will normally create a proration for the next renewal invoice

desert summit
#

req_M59jYfPSVK247W

#

Okay so I should simply not set the payment_behavior, and set the proration_behavior to create_proration? Then triggering this invoice will work

cursive compass
#

That's what i expect, yes

desert summit
#

Indeed, I just tried and it does what I expect. It's creating a draft invoice, I guess I need to trigger the payment of it right away?

cursive compass
#

Or whenever you want to, yes. You can finalize and pay or send it.

#

Excellent - glad that does what you're looking for ๐Ÿ™‚

desert summit
#

Wow that's so simple, I was trying to trick the thing so hard

#

lol

cursive compass
#

๐Ÿ˜„

desert summit
#

I couldn't really get it from the doc tbh

cursive compass
#

That's fair

#

It's tough to decide what to cover completely because the API is rich and there are a lot of different flows people want

desert summit
#

Thanks a lot both of you ๐Ÿ™

desert summit
#

Very impressed by the reactivity and the service

#

I can sleep well tonight thanks to you lmao

cursive compass
#

Thank you for saying so!

#

And happy to hear you'll be able to get some rest ๐Ÿ˜ด

desert summit
#

Have a nice rest of the day ๐Ÿ‘‹๐Ÿป

cursive compass
#

You too!