love this as someone who's been fixing the same billing bugs over and over and who sometimes finds stripe more complex than it should be. will make sure to try this on my next adventure.
btw, if you still want to go directly with stripe, here are some general recommendations/notes I generally agree with:
Thank you! We try and take case of most of these bugs and edge cases. I think the ones that have been most useful are:
1. Race conditions. There are some weird conditions to handle around if a user makes it back to your app post-payment before the webhook, or if they click twice on a purchase button accidentally.
2. Keeping usage reset cycles in sync with billing cycles. We had a bunch of weird cases to solve in February as it's a shorter month.
3. Handling annual plans that have monthly usage billing cycles. Or just handling anything to do with transitioning between annual and yearly billing.
Theo's approach is awesome and a very similar architecture to what we have.