#jdbadger-balance
1 messages · Page 1 of 1 (latest)
hello, you get a balance.available event if you are on manual payouts when the Balance is available in your Stripe Balance
Thank you so much for your response. I think we'll be relying on the daily automatic payouts. Could I instead listen for payout.paid/payout.failed events and then just iterate through my charges to update them and their balance transactions (It wouldn't be anything like thousands of charges at a time)? Would charge.balance_transaction.status be 'available' at that point in the case of a payout.paid event?
the Charge's BalanceTransaction won't update/mutate
but yes on Automatic Payouts you won't get balance.available but rather an Automatic Payout at that time instead since Stripe will send you funds
so what you can do is use list all BTs in a Payout: https://stripe.com/docs/api/balance_transactions/list#balance_transaction_list-payout
and iterate through those and that will get you which Charges contributed to this automatic Payout
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Cool. I think I understand. So I would listen for payout.paid/payout.failed and when I receive those events, retrieve a list of all the BTs associated with the payout, and use BT.source to find the charge in my own database and mark its associated donation as 'paid_out' or something...
yes, protip you can just pass expand: ['source'] in that BT.list() request so you don't have to make another Charge.retrieve() request to fetch the Charge
perfect - thank you so much for your help