#eskombro-hourly-usage
1 messages ยท Page 1 of 1 (latest)
Hi ๐ it does sound like metered billing is going to be the route you want, give me a moment to wrap up another train-of-thought and I'll be right back to chat further.
Thanks for your answer Toby. No problem, I'll be around
Apologies about that, and thank you for your patience.
No problem! ๐
I do think that Usage Records for metered billing is the way to go here, but would like to better understand the concerns you have with this approach to ensure I'm not overlooking a limitation.
Ah, hang on. I just reread your original post and think I understand now.
Let's say your user has a monthly subscription for the service, and we'll assume we're in a month with 30 days. At the end of the billing cycle you want to bill the user for a month's worth of hourly usage, in this case that would be 30 x 24 x [HOURLY_PRICE]. Is that right?
Basically, our user can subscribe to use our product anytime, and cancel it anytime. And the billing will be done only for the effective hours of usage of this product. So if the user subscribe only during 3 hours, at the end of the month he will be charged for those 3 hours. But in the case the user creates a subscription and doesn't stop it before the end of the month, he will be charged for every hour from the moment he subscribed, till the end of the month. So basically what I need to build is an hour-based billing with a monthly invoice
But from what I read in the docs, this means that I should create a Price in Stripe with a fixed price for an hour (my unit), and create a metered subscription, in which I will need to report every hour that I want to charge him for, via the API. Is that right?
Yeah, that is a really tricky scenario.
Rather than reporting each individual hour of usage, you can also report a total or total-to-this-point type of usage. It's going to depend on the aggregate_usage type that you define.
What I think you might be able to do (about to confirm with my team) is wait for the invoice to be generated for the billing period, then calculate the usage and update the subscription before the invoice finalizes.
Thanks, I know it is a bit of a tricky one! But I wanted to confirm if I have to base my strategy on reporting usage on my side to Stripe.
Ideally, I would like to say: hey, this user started using this product at this moment. Charge him for his usage. I don't see the point in reporting the usage (in my case) as I assume that the user is 'using' the product as long as the subscription is active. So I was hoping to be able to create an invoice based on how long the subscription has been active, and avoid reporting the hourly usage.
Thanks a lot for the time, and if you get a confirmation from your team about that approach reporting the usage when the invoice is being generated and update the subscription I would like to understand a bit more about it ๐
Alright, so I think there are a couple approaches, but none of them are what I'd refer to as elegant.
My thought about adding usage records after invoice generation won't work, at that point the subscriptions billing cycle will have rolled over and you can't add new usage records.
You could hook onto the invoice.created event and then either 1) create a separate charge for the customer (outside of the subscription) for their usage or 2) calculate the usage and add it as an Invoice Item to the pending invoice.
https://stripe.com/docs/api/events/types#event_types-invoice.created
Another approach is to use some sort of hourly job to report usage to us each hour. This definitely could get noisy, leave a long list of transactions that would make troubleshooting tricky, and could be confusing.
The most extreme approach is to move your subscriptions out of Stripe, into a custom flow on your end, and then just use Stripe for charging your customers at the end of the subscription periods or when the user cancels.