I recently looked into how to build out robust usage reporting with Stripe.
This comes basically from the set of challenges around:<p>- Workaround Stripe API Rate Limits<p>- Handle billing cycles and minimize usage drift into the next billing cycle<p>- Deliver usage exactly once to avoid under and over-billing<p>- Stripe requires to report usage on Subscription Items<p>You can read the full blog post here:<p>https://openmeter.io/blog/how-to-report-usage-to-stripe<p>I'm curious about what people do to build our usage reporting.
Do you use message queues? Workflow management software like Temporal? Simple CRON job?
I ran into Stripe's API rate limits while developing a revenue forecasting app[1]. The metrics calculated requires retrieving two months of charges using Stripe's API, which can result in long loading times because only 100 records can be retrieved at a time[1] and because:<p><i>...listing charges (or most resources) can be quite slow as you need to render many objects. The Charge API especially is quite a large object to render and paginate through.</i>[3]<p>Overall, getting 100 records from Stripe's charges endpoint takes 3 to 4 seconds<p>[1] <a href="https://github.com/hbcondo/revenut-app">https://github.com/hbcondo/revenut-app</a><p>[2] <a href="https://stripe.com/docs/api/pagination#pagination-limit" rel="nofollow noreferrer">https://stripe.com/docs/api/pagination#pagination-limit</a><p>[3] <a href="https://github.com/stripe/stripe-dotnet/issues/2284#issuecomment-777192698">https://github.com/stripe/stripe-dotnet/issues/2284#issuecom...</a>