#Marsh

1 messages ยท Page 1 of 1 (latest)

lyric nicheBOT
restive bear
#

๐Ÿ‘‹ Happy to help!

rich ocean
#

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

restive bear
#

Your code is on the right track, but the List Balance Transactions API requires expanding of data.source to get the charges information

rich ocean
#

aaa ok let me try it

#

tahnks a lot ๐Ÿ˜„