#lennard.
1 messages ยท Page 1 of 1 (latest)
Hi ๐
What do you mean "trigger a new metered billing"?
Do I just store cus_OYhHfYSIEWoiIB
That does not make sense
Right
eg. they make a new request, add one to their billing
What does not make sense?
@rose oasis So let me refactor:
I got all info from my customer. What do I exactly need to store in my Supabase database?
So I can then do https://stripe.com/docs/api/usage_records/create to record their usage and add to their billing
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Gotcha, okay
So you have created a Subscripiton for this customer with a usage based price?
Okay I didn't need to see it, just that you have created this beforehand
Yes and the test sub is on that pricing
Would I save any more info other than price id and customer id on the db?
So, you remember that recurring billing pricing model I sent you?
All the information is there
Specifically this section: https://stripe.com/docs/products-prices/pricing-models#reporting-usage
Thanks
So the only 2 things I need to store in the user object, is the customer id and subscription id?
No, that is not what that document says
The code snippet for reporting usage records clearly shows you need the Subscription Item ID
Oh ofc yeah, talking generally
What do you mean, talking generally? I thought we were discussing specific API actions and how to achieve your desired behavior
But in general, you can choose to store only the customer and subscription IDs, and you can look up the other related information through the API.
But you would likely want to keep either the Subscription Item ID or at least the Price ID that corresponds to the usage-based price so you know which subscription item ID to use when you create the usage records
So I would recommend you think through how you are going to write your integration. How it is going to track your customers usage and report that to Stripe. Figure out what information you will need to store locally to make that work based on your own logic and the parameter required to make the necessary Stripe API calls.