#Annesha-metered-proration

1 messages Β· Page 1 of 1 (latest)

cobalt creek
#

Hello, yes I can. What would you like help with?

shrewd lily
#

I am trying to build a subscription in my stripe account.. with this kind of model. I understand that its a metered billing.. but how to generate this kind of prorated amount every month for additional user onboarded

cobalt creek
#

Can you clarify a bit what the costs are in your picture?

#

What makes up the $40 charge and what is part of the $52 charge?

shrewd lily
#

1st January at the time of sign up, there were 5 users onboarded in my account===>At the rate of 8$/user monthly plan , its 5*8$ = 40$

#

15th January one more person is onboarded in the account

#

So on Feb I charge 6*8$ = 48$

#

And additionally 4$ for the January month usage from 15th -> prorated amount

#

So a total of 48+4 = 52$

cobalt creek
#

Thank you for the clarification. And there is a metered aspect on top of this as well?

shrewd lily
#

see.. the 6*8$ is a metered calculation.. where I increement the unit parameter of the subscription each time there is a new user onboarded

#

This gives me a total number of units consumed at the end of the billing anchor * the price/unit

#

that is Feb month's 6*8$

#

That is simple

#

How to add the prorated amounts.. like a user onboarded on 15th or 20th.. so the usage calculation of these users should be prorated

#

Like 4$ for 15th onboard and lesser for the 20th onboard

cobalt creek
#

Is there a reason you are not doing this with subscription quantity? I think that that would achieve the behavior you want easier.

#

For metered billing I think you will have to manually calculate that proration amount yourself and charge them for 5.5 units. With quantity our proration logic will automatically charge them for the .5 of the month and then a full monthly amount every month

shrewd lily
#

Actually ..this is an organization level subscription.. where we need to bill a single email address / account. So at the time of subscription the user can onboard a certain number of users.. and based on that number of users we charge the client account. Eventually there might me more and more users onboarded.. and deboarded .. So based on that usage we need to charge the customer for the follpwing month

#

The subscription quantity is used when the customer subscribes to our product for the first time.. But for the subsequent months.. I need a way to charge the customer on a prorated format for the newly added or deleted users from the account

#

I saw many SaaS products like Slite and Guru are achieving this kind of billing using Stripe.. so I guessed it might be possible

cobalt creek
#

I would still recommend using quantity for that pricing model. If you update the quantity of a subscription up and down Stripe will do this proration logic for you. If a customer from your example got deboarded in the middle of next month then they would get charged for 5.5 then 6 then 5.5 times your monthly fee

#

You can probably achieve the same thing yourself by charging by usage but you would have to be doing these calculations yourself essentially

shrewd lily
#

you mean to say.. every usage record should Update the current subscription's quantity field?

#

Or do you mean I keep creating new subscriptions everytime a new user onboards?

#

How would I merge the individual subscriptions and bill under a single organization level billing ID ?

cobalt creek
shrewd lily
#

Ohkay.. you mean I should simply update the quantity field based on the onboard or deboard.. and stripe would take care of proration?

cobalt creek
#

So from what you have described, I think you can achieve this with one subscription object with the $8 price and a quantity of 5, then when the user is onboarded, update the subscription item for that $8 price to have a quantity of 6

#

Correct

shrewd lily
#

Oh.. was it that simpleπŸ˜†

cobalt creek
#

Sounds like it! Less headache for you I hope

shrewd lily
#

Great !..

#

One more thing

#

So.. suppose a customer subscribes on Jan 1st.. I charge him beforehand for the entire month of January. That is 40$. He uses it.. onboards new people.. I update the quantity meanwhile.. and on 1st Feb.. the stripe charges him for currently updated quantity of subscription amount and the prorated amount also.

#

Also.. if I take this approach.. will it still fall under metered billing?

cobalt creek
#

The approach I recommended does not fall under metered billing.

#

I think you are correct that that is how the charges would work out in that scenario. Let me double check

shrewd lily
#

Sure..

cobalt creek
#

Yes that would be the correct behavior. On 1st feb they would be charged $52 for the 6 users and the half month of being at six users from the last billing period

shrewd lily
#

oh.. only the 6th user amount would be charged at prorated or the entire bunch?

cobalt creek
#

It would be the behavior you described in your diagram. The first month they are charged $40, at the half month they are not charged, on Feb 1 they will be charged $48 + that half month for the sixth user

shrewd lily
#

Great!.. πŸ˜€

cobalt creek
#

Always nice when things just work how you want them to

#

Any further questions on that at the moment?

shrewd lily
#

Yes hon!

#

Thanks.. so it would be which kind of subscription then?

#

Fixed?

#

Or Licence?

cobalt creek
#

Good question. This would be Fixed

shrewd lily
#

Okay .. thanks savior !

#

Another question.. may I ?😐

cobalt creek
#

Of course

shrewd lily
#

I am using the stripe account in Test mode now. So after I make this kind of siubscription flow. How can I check the proper billing invoices..within 1-2 days? I dont wanna wait for a month to generate the invoice to see.. if this pricing model is working as per my requirement.

cobalt creek
#

To get an initial invoice the easiest way is to make a trial period of a few seconds is by setting trial_end to now + x seconds

#

Not sure what language you are using but here is the Python snippet I used to test your scenario ``` sub =stripe.Subscription.create(
customer=customer.id,
items=[
{
'price': 'price_1JeMFIJmquaq3LbpjZkuokl0',
'quantity': 5
},
],
expand=['latest_invoice.payment_intent'])

items = items = [{
    'id': sub['items']['data'][0].id,
    'price': 'price_1JeMFIJmquaq3LbpjZkuokl0',
    'quantity': 6
}]

proration_date = int(time.time() + 15 * 24 * 60 * 60)

invoice = stripe.Invoice.upcoming(
    customer=customer.id,
    subscription=sub.id,
    subscription_items=items,
    subscription_proration_date=proration_date,
)

print(invoice)```
shrewd lily
#

Oh Thanks!

#

I am using Node

#

But this definitely helps!

#

😊