#GraceLR
1 messages · Page 1 of 1 (latest)
Have you tried setting auto_advance=false when making the finalize call? https://stripe.com/docs/api/invoices/finalize#finalize_invoice-auto_advance
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
yes, i console.logged the invoice after finalizing, still showed as paid
but let me double check again
just checked again, console.log the invoice after finalization, still status paid
Gotcha, unfortunately I don't think there is a way to prevent that at the moment then. You will need to try to push back the finalize call if possible
hmm, i see. The reason I want to do that is because I want to make a transfer before finalize, and the transfer amount is the difference before ending balance and starting balance.
Then I want to change the status to paid after the transfer succeeded
But without finalizing, the ending balance is null
So if there is a way, we can get the correct number of the difference between ending and starting balance, before finalizing, it also works for me
You can retrieve the upcoming invoice to see what it will look like. That should give you the difference https://stripe.com/docs/api/invoices/upcoming
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
my main concern is the credit balance. what if somebody else finalized an invoice after i retrieved the upcoming invoice, which might change the credit balance, then the credit balance applied to my invoice might be wrong, and the ending balance is wrong.
Are other users using the dashboard or something to do this? Or are these other API calls from what you are programming that might finalize this invoice?
If they can always finalize while you are doing something else, then I am not sure what you can do here. I can put in the feature request to allow these invoices to stay in an open state but in the mean time I think there will always be a chance that one of your colleagues just finalizes the invoice out from under your application.