#jatin_best-practices
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1253284420513960011
📝 Have more to share? Add details, code, screenshots, videos, etc. below.
hi! you can just add something to the customer balance, or add a negative invoice item.
https://docs.stripe.com/billing/customer/balance#api
https://docs.stripe.com/billing/invoices/subscription#adding-upcoming-invoice-items
I think, I should rephrase my case. Let me re-iterate.
We are a developer tool platform using Stripe for our billing needs. Our primary model is a pay-as-you-go pricing structure. Clients use our services throughout the month, and we generate an invoice at the end of the month, which they pay before the due date. We send our service usage data to Stripe, which then generates the invoice—this part is working well.
However, we have a few enterprise accounts with a different arrangement. These clients have a deal where they add a certain amount of funds (e.g., $100/month) to their Video SDK account, which is added as credit. When their monthly usage-based invoice is generated, this credit is applied against their balance.
Currently, this process is manual. We are looking for a way to automate it. Specifically, we want to:
- Charge these enterprise clients on a monthly/quarterly basis from their saved card.
- Add the charged amount as credit to their account.
- Automatically adjust this credit when generating the monthly usage-based invoice.
Can we use Stripe's "Subscription" feature to achieve this? If not, what would you recommend as the best approach to automate this process?
We've already used the feature to add the customer balance. The only problem is, it's manual. Clients has to add the funds manually to their Video SDK account, using our dashboard.
We want to automate this. Any method?
sure, you can automate it by writing code to call the APIs I mentioned avove.
Got it. So, using the same functions, but programmatic API call.
Is that what you're mentioning?
yes
not sure how else you envision this working, how would Stripe know that a user has "added funds to their Video SDK account" unless you call our API to e.g add a credit balance to the relevant cus_xxx object for the amount of those funds ?
even if you're charging a saved card card in a payment on Stripe, those funds just go to your merchant balance for payout; if you want to treat that as a credit balance it requires manually setting those customer balances/negative invoice items, we don't have that functionality built in(a native "wallet" feature for example)
I'll check with our finance, if they're okay with receiving this "Balance" as a payout.
That's internal, but thanks for pointing it. That can be addressed.
A question I have is...
When I implement your suggested workflow, will I be able to charge the client's card automatically? (After that, I've to make an API call to add the balance in stripe, that is clear)
it depends what you mean by "automatically".
like, a recurring Subscription charges a card on a recurring basis automatically
I mean, auto-debit or auto-charge from client's saved card
when would the auto-debit happen? triggered based on what?
See... what I need is...
- Charge a client with fixed amount (that can be auto-debited from client's saved card)
- Add that exact amount in client's balance (in stripe)
Is this possible, via "Payment links", via "Subscription", or via combination of any other APIs?
when would the auto-debit happen? triggered based on what?
you can charge a saved card at any time by making the API calls described at https://docs.stripe.com/payments/save-during-payment?platform=web&ui=elements#charge-saved-payment-method , for example.
after a payment succeeds you can call https://docs.stripe.com/billing/customer/balance#api to update the customer's balance for the amount that you just charged in that payment; for instance.
Cool. This addresses my question. We have to make use of these two features as a combo.
And, charge a client on monthly basis.
And, charge a client on monthly basis.
you mentioned you already have a Subscription, so you are already doing this it seems?