#tomas at amenitiz
1 messages ยท Page 1 of 1 (latest)
Don't think that's possible, confirming
I've tried issuing the invoice as such, snippets using the Ruby SDK:
Stripe::InvoiceItem.create(invoice: "in_1MmD1wIsA9C1ybP08o0KmVyV", customer: "cus_KfRRXDSpUuy0oC", amount: 6000, description: "asd")
Stripe::Invoice.pay("in_1MmD51IsA9C1ybP0CM9OM137", { paid_out_of_band: true })
I suspect you may need to temporarily increment the balance amount
I don't want the balance discount to reflect on the invoice though, so I imagine I need to:
- Get the balance amount and store it
- Set it to 0
- Issue the invoice
- Set the balance amount back to what it was
(the examples I sent was with a balance amount of 4000 cents, not 20000). The invoice ended up being for 2000 cents; when what I need is an invoice for the full 6000 cents; and the balance to remain unchanged. Don't know if I'm being clear with my use need
I'll wait, please don't close me ๐
Then yep, that's the workflow you'll need to implement
Beyond race conditions, is there any other side effect I could introduce doing this? The balance is just some "store credit" I extend to my customers, but there's no real movements of funds, right?
I mean obvious side effects, I realise managing the complexities of a transaction is actually my job
The only time (AFAIK) Stripe automatically increments/decrements that balance is for prorations. And correct, there's no actual funds associated to it
Last question, this one is a lot simpler
What's the endpoint to change this balance? ๐คฆโโ๏ธ
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You can't just mutate it directly, needs to be an associated transaction to increment/decrement
Oh, I get it, thanks
So this won't have any other side effects either, no? Like issuing a pair of opposite balance transactions should result in no changes to the balance state (aside from logging the transactions)?
Correct
Thanks! Apparently I can do it updating the customer directly too: https://stripe.com/docs/api/customers/update
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You've been really helpful, my doubts are clear
Thank you very much, have a nice day ๐