Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stripe: No such external account but the external account do exist

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:

enter image description here

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"
 }
}
like image 370
sydridgm Avatar asked Oct 25 '25 23:10

sydridgm


1 Answers

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"},
)
like image 113
virtuexru Avatar answered Oct 29 '25 04:10

virtuexru