#Marsh
1 messages ยท Page 1 of 1 (latest)
๐ Happy to help!
Hey!
I have this for now
account = Stripe::Account.list_external_accounts(
ACCOUNT_ID,
{object: 'bank_account', limit: 3},
)
bank_account = account.data.first.id
payouts = Stripe::Payout.list(
{destination: bank_account, limit: 100, status: 'paid'},
{stripe_account: ACCOUNT_ID}
)
payouts.data.each do |payout|
payout = payout.to_hash
payout[:payout_type] = payout.delete(:type)
StripePayout.create(payout)
balance_transaction = Stripe::BalanceTransaction.list(
{limit: 100, payout: payout[:id]},
{stripe_account: ACCOUNT_ID}
)
balance_transaction.data.each do |transaction|
transaction = transaction.to_hash
transaction[:balance_transaction_type] = transaction.delete(:type)
StripeBalanceTransaction.create(transaction)
end
end
and that gices me balance transactions and payouts
but I can't find those payouts
To find out the paymentsin the payout, you may use List Balance Transactions API with expanding data.source. You may refer to the guide here: https://stripe.com/docs/expand/use-cases#charges-in-payout
Your code is on the right track, but the List Balance Transactions API requires expanding of data.source to get the charges information