#dragonlord_api
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/1305952214530916362
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- dragonlord_api, 4 days ago, 9 messages
- dragonlord_api, 4 days ago, 16 messages
Hello! Can you provide more details? What specifically are you confused about? What have you tried that hasn't worked?
I do not know what endpoint to call to update the billing credits
What do you mean by "update"? Do you mean grant them the credits in the first place?
If so, this one: https://docs.stripe.com/api/billing/credit-grant/create
See also this page: https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits
I am able to create the credit grant how do you decrease it as the person uses it
I was trying to use
` $stripe->billing->meterEvents->create([` to update the credits
but then I get the error
No active meter found for event name
We automatically apply credits to Invoices. See here: https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits/implementation-guide
Can you give me the request ID showing that error? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
yes I get you but I want apply the credits, but for example I want to decrease the credits as the user uses a certain feature
You do that by Invoicing them for that usage.
You don't manually decrement the credits, that's what the invoicing process is for.
The idea is that you record their usage, then Invoice for that usage: https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage
I want to charge them in the beginning but as they use the credits I can say they used x amount of credits I do not think the current process makes sense.
Like I want them to prefill their account and as they use the service they get charged
Yeah, that's what this does.
They buy credits, you add those credits, then you record usage, then you Invoice for the usage, then the credits are applies to the Invoice.
I do not want to record their usuage I want them to pay initially and they decrease from their credits as they use it and stop when credits as they use it
I do not want to keep track of their usuage
That's not how this works.
This is what I want to do exactly what it says
In this model, you can get prepayment for usage-based products and services. Using Billing Credits, users can pay an initial amount and “burn down” on their billing credits as they use the product.
Yes, and I'm trying to explain how that works.
You still need to record usage and Invoice for it.
The Invoice will be paid using their credits.
What you are saying and the text I sent do not align.
The user is supposed to pay initially and they lose credits as they use a product and they pay again if they want more credits.
I do not want to invoice after usuage
I understand what you're saying, but I'm trying to explain to you that's not how it works and you have to Invoice.
If you don't want to do that you need to keep track of usage on your end and not use our system
interesting
I would encourage you to give this a try in test mode, though, because I think it might work better than you think.
I have tested it out
I just want to a way to say for example I got 10 dollars worth of credits
After x times the 10 dollars is now worth only 5 dollars
and so one
I can refill my balance again later now my credits are 15 dollars
Yeah, that's how this works. When your Customer pays you for credits, you create a Credit Grant to assign to those credits to that Customer. Then you record their usage. Then you Invoice for their usage. Then the Invoice is paid for by their credits, reducing them by the amount used that's being Invoiced.
You seem to want to only record credits, increasing and decreasing them arbitrarily without recording usage or invoicing for usage.
That is now how our system works.
If you want to do that you need to not use our system and keep track of credits on your end.
How do I record usage
To put it another way, our credits system is not designed to be arbitrarally decremented manually.
like how do i know the user used x credits
Recording usage is explained here: https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage
Credit Balance Transactions indicate when credits are used: https://docs.stripe.com/api/billing/credit-balance-transaction
You can also check on the current status of a given credit balance using Credit Balance Summaries: https://docs.stripe.com/api/billing/credit-balance-summary
So I can get the available credit from https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits/implementation-guide?dashboard-or-api=api#get-available-billing-credit-balance
Why is their not one endpoint where I can decrease the credits easily
Yes.
Because the system is not designed to work that way.
The balance is decremented by Invoicing the Customer.
this is what I do not understand can this be requested
like it's such a nice feature to have
You can write in to Stripe Support with that feature request, sure: https://support.stripe.com/contact/email
Okay how do I invoice the user to decrease the credit
That's explained in the docs linked to above.
Only if they don't have enough credits to cover the Invoice.
okay this is basically what I want
If the Invoice is for $10 and they have $15 worth of credits they don't need to pay, for example.
Yeah, I know, that's what I've been trying to explain the entire time. 🙂