#bruno-billing-balance
1 messages · Page 1 of 1 (latest)
Thanks
So it's unfortunately not possible to apply the customer balance to a specific future invoice or to skip paying the next invoice with a customer balance. You should still be able to accomplish the desired outcome of the edge-case, but I'd need a bit more info.
Are your customers only going to have credit balances? Or will they also have cash balances? (more info here on the difference: https://stripe.com/docs/billing/customer/balance)
Gotcha about the first comment.
The customers are only going to have 'credit balances'.
They won't have cash balances.
I'm curious to hear how to accomplish my edge-case scenario. Let me know if you need more input.
So, it is a workaround, but I think the best way to do this would be to check if the customer has a credit balance (example API request here: https://stripe.com/docs/payments/customer-balance#view-balance), then:
- if no: create subscription as normal
- if yes: get the balance amount (see field on Customer object: https://stripe.com/docs/api/customers/object#customer_object-balance), then create a balance transaction (as a negative integer) for that amount (API call here: https://stripe.com/docs/api/customer_balance_transactions/create), then create the subscription and take payment. Once all of this is done, you can reapply the credit balance by creating another balance transaction with a positive amount
Does all that make sense?
Ok, yea, that does make sense.
I'm a little wary of manipulating customer's balance (bugs and all), but I'll consider it, if that's the only approach.
I don't think it's the only approach, but it feels like the simplest to integrate comparatively.
With the least side-effects or additional state tracking
Got it.
I was checking the docs and saw payment_settings.payment_method_types subscription option. I tried setting that option to payment_settings.payment_method_types = ["card"] expecting a subscription will only use card as a payment method - but that didn't happen. The subscription was paid with a customer_balance.
I had high hopes 😄 . But am I missing something? Tweaking this one subscription option would be more acceptable than managing customer's balance.
I wish it were that easy, but the customer balance essentially always holds priority over payment methods