#saintnz_webhooks
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1434838618551222316
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi there ๐ taking a look into your question now
there's no event/alert within the Stripe API specifically to notify you when a credit has been fully used
however, you can use the billing.credit_balance_transaction.created event to be notified when a customer's credit balance is adjusted
https://docs.stripe.com/api/events/types#event_types-billing.credit_balance_transaction.created
you can then use the API to get the credit balance summary
https://docs.stripe.com/api/billing/credit-balance-summary
Sounds like you are saying the only way to detect the credit being fully used up is to retrieve the credit balance summary after every meter event...?
just taking a moment to confirm if that's correct
thanks for your patience, just running a quick test
The upcoming invoice appears to show the credit grant burning down but I am not sure if it is actually burnt down until an invoice is finalized with that burndown...
can you share the ID of the credit grant?
I was looking at this test subscription: https://dashboard.stripe.com/acct_1SO9KDRwlPtkx00W/test/subscriptions/sub_1SO9lKRwlPtkx00WvJMtX7ml
so, I think it should be possible to use the billing.credit_grant.updated event to track this, by checking for updates to the amount.monetary.value property
https://docs.stripe.com/api/events/types#event_types-billing.credit_grant.updated
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Are you sure about this? When I view the same credit grant referenced in the screenshot above via the dashboard, it shows that it has not yet been applied at all.
I'm going to reinvoice the subscription to see if that changes the state...
It did:
yes exactly, the grant hasn't actually been used until it's applied to an invoice
Cool. So in my scenario I don't have a simple way to detect when to charge the customer for another credit grant when the old ones runs out because the previous grant wil not run out until it is invoiced.
just to confirm, calling the Credit Balance Summary API is the recommended way to track credit usage:
https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits/implementation-guide#get-available-billing-credit-balance
Ok thanks for your help. I have a much clearer picture now ๐
you're welcome ๐