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:
- Create the User's external account and attach a bank account: https://stripe.com/docs/api/accounts/create
- 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 = "[email protected]",
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!