#Nstripe0-customerbalance

1 messages · Page 1 of 1 (latest)

fickle kayak
#

Not really - Customer balance is pulled into the finalized invoice for that customer. Is there some particular use case/flow you're trying to figure out?

candid kayak
#

Hi @fickle kayak

Yea, this is related to an earlier question about the customer balance.

#

We want to try to use the customer balance, but are concerned that it would be applied to cases where we don't want it to apply.

So we're trying to figure out the right way to approach this.

fickle kayak
#

Copying this here so I don't have to switch between threads:
"Hi Rubeus, thanks. Sorry for the delay, we have both subscription based and one time purchases capabilities on our product.

Internally, we have the concept of subscription credits internally that we want to be able to apply towards the subscription payments only.

In thinking about the moving that subscription credit over to Stripe, one issue we foresee is that those credits being utilized for non-subscription charges.
And that's why we were wondering if there was a way to segregate the customer balance."

#

We don't support what you're trying to out of the box, but I think it's something you could build on top of Stripe. I will say, it may just be easier to leave it separate if what you have is already working

candid kayak
#

Thanks for the input.

We would still need to account for the subscription credits in the amount invoiced.

So one approach could be to modify the invoice while it is in draft state. We'd need to figure out what way to modify it such that it is not treated as a discount though. We'd like to treat it as a form of payment.

fickle kayak
#

You could put that credit in the form of a negative invoice line item (but I'm not sure if that really aligns with your requirement of not treating it as a discount). Alternatively, you could add some amount to the customer balance and immediately finalize the invoice that you want to apply it to

candid kayak
#

Yea, that approach (funding customer balance when invoice is created) was suggested.

The potential complication there is that if the invoice payment fails, the balance stays there creating a larger window for mis-application for other payments.

I think the negative line item would impact the taxes on the invoice, but we'll investigate that more.

fickle kayak
#

"The potential complication there is that if the invoice payment fails, the balance stays there creating a larger window for mis-application for other payments."
Digging into this a little more, would your desired behavior be that the customer balance is returned/removed from the invoice if payment fails?

candid kayak
#

The desire would be to have it earmarked for that particular invoice.

Since invoices may be retried over a period of time, we wouldn't want it to be removed from availability yet.

fickle kayak
#

I believe that's what we already do though - if payment for an invoice fails, the customer balance would stay there until the Invoice was voided (which is the default). If you wanted to not return the customer balance once the invoice is voided, that's something you can configure by setting invoice_customer_balance_settings[consume_applied_balance_on_void]: false when you create the subscription

candid kayak
#

Oh interesting.

When is the customer balance actually consumed?

Are you saying that when an invoice is finalized, that it would consume some of the customer balance?

I may have been thinking about it wrong,

fickle kayak
#

Yeah, customer balance shouldn't be consumed until the Invoice has been finalized

candid kayak
#

Ok, and once finalized, it will consume them it sounds like. That's good.

Maybe that approach would work. I'll give this a try, thanks for your guidance!

fickle kayak
#

Glad I could clear that up! Definitely mess around with them a bit and see if it all makes sense. Also, just so you have all the information - the point about consume_applied_balance_on_void is talked about here: https://stripe.com/docs/upgrades#2019-12-03

Keep track of changes and upgrades to the Stripe API.

candid kayak
#

Thanks for the reference, those API upgrade notes talk about invoice_customer_balance_settings on Subscription Create and Update, but I don't seem to see that parameter on the API docs.

#

Oh, that's for earlier API versions!

#

Got it

fickle kayak
#

OH SHOOT - I'm sorry about this, I misread our api changelog

#

So really the behavior is like this:

  • We return any customer balance once an invoice has been voided.
  • Only earlier API versions will fully consume the balance when an invoice has been voided. There is no way to emulate this behavior for newer api versions