I create an account in stripe under test module by stripe api. And bind a bank account with this account. Go to Stripe dashboard -> connect -> accounts, I could see the account which I created. Click it and to see the detail, I could see the external accounts:

but when I want to create a payout to this bank account:
curl https://api.stripe.com/v1/payouts \
-u sk_test_*********: \
-d amount=400 \
-d currency=usd \
-d destination=ba_1CrVQnJziGn15h8UAvSlEUfI \
-d source_type=bank_account
It gives me error:
{
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such external account: ba_1CrVQnJziGn15h8UAvSlEUfI",
"param": "destination",
"type": "invalid_request_error"
}
}
Here's the correct code to do this.
When trying to list payouts on a connected account, you have to make the API request authenticating as this account so in addition to the destination bank account ID you need to pass the stripe account ID.
payouts = Stripe::Payout.list(
{:destination => external_account},
{:stripe_account => "acct_XXXXXX"},
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With