简体   繁体   中英

Payout to User's External account bank account gives 'No such External Account...'

I have a very frustrating problem and Stripe's documentation/customer service have been giving me the run-around and my question is still not resolved.

I am trying to implement a payout programmatically in C# to a user's bank account.

Amounts are accumulated in one stripe account (my account) but users have 'balances' that our backend keeps track of. When a user decides they want to be paid out, this is where I am running into an issue.

So far, this is what i've implemented:

  1. Create the User's external account and attach a bank account: https://stripe.com/docs/api/accounts/create
  2. Create a payout object: https://stripe.com/docs/api/payouts/create

But the problem occurs when I create a payout and add a destination to that payout. The reason for this is because a user might have more than one bank account linked to their external account.

I have something like this:

Create an external account for user

Account userCustomAccount = await account.CreateAsync(new AccountCreateOptions()
{
    Type = "custom",
    DefaultCurrency = "usd",
    Country = "US",
    Email = "user@fake.com",
    LegalEntity = new AccountLegalEntityOptions() {...},
    ExternalBankAccount = new AccountBankAccountOptions()
    {
        AccountHolderType = "individual",
        AccountNumber = "123456789",
        RoutingNumber = "987654321,
        Currency = "usd",
        Country = "US",
        AccountHolderName = "Test User"
    },
    TosAcceptance = new AccountTosAcceptanceOptions(){...},
    PayoutSchedule = new AccountPayoutScheduleOptions()
    {
        Interval = "manual"
    },
    PayoutStatementDescriptor = "TEST"
});

Create a payout

var sourcePayout = new PayoutCreateOptions()
{
    Amount = 100,
    Currency = "usd",
    Destination = bankAccountId,
    SourceType = "bank_account",
    StatementDescriptor = "PAYOUT"
};

where bankAccountId is the id ( like ba_xxxx ) that I retrieved from userCustomAccount.ExternalAccounts

I get an error when attempting to call payout saying that "No such external account exists"

Any idea how to resolve this? I don't understand why this is so difficult to do and why this is giving me so much trouble.

Thanks!

since you are creating payout to the connected account from your platform account, you will need to use the Stripe-Account header

What you are doing now is creating a payout for your own account with the connected account's bank id.

in C#, you would need to use the requestOptions

var requestOptions = new RequestOptions();
requestOptions.StripeConnectAccountId = "CONNECTED ACCOUNT ID"; 

.... 
....
var payout = await PayoutService.CreateAsync(sourcePayout, requestOptions);

The key things is whenever you are operating on your connected account other than creating account itself, such as creating charge, payout, creating customer on connected account, you will need to pass the Stripe-Account header.

if you are creating payout from platform to connect account's external account, directly it might not be done. first send the fund from platform balance to connect account using transfer api. transfer api .

and then create a payout on the connect account. generally the payouts are automatic, and after the preset minimum number of days(for US 2 days), the payout is created with all the available balance in the connect account balance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM