向用户的外部帐户银行帐户付款会显示“没有此类外部帐户...”

时间:2019-01-24 07:11:55

标签: c# api stripe-payments stripe-payout

我遇到了一个非常令人沮丧的问题,Stripe的文档/客户服务一直在给我提供解决方法,而我的问题仍然没有解决。

我正在尝试以C#编程方式对用户的银行帐户进行付款。

金额累积在一个条带化帐户(我的帐户)中,但用户拥有我们的后端跟踪的“余额”。当用户决定要付款时,这就是我遇到的问题。

到目前为止,这是我已经实现的:

  1. 创建用户的外部帐户并附加一个银行帐户: https://stripe.com/docs/api/accounts/create
  2. 创建付款对象: https://stripe.com/docs/api/payouts/create

但是,当我创建付款并将目标添加到该付款时,就会出现问题。这样做的原因是,用户可能有多个与自己的外部帐户关联的银行帐户。

我有这样的东西:

为用户创建一个外部帐户

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"
});

创建付款

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

其中bankAccountId是我从like ba_xxxx检索到的ID(userCustomAccount.ExternalAccounts

我在尝试支付时收到错误消息,提示“不存在这样的外部帐户”

任何想法如何解决这个问题?我不明白为什么这样做很难,为什么给我带来很多麻烦。

谢谢!

2 个答案:

答案 0 :(得分:0)

由于您是从payout帐户中为连接的帐户创建platform,因此需要使用Stripe-Account标头

您现在正在做的是使用关联帐户的银行ID为您自己的帐户创建付款。

在C#中,您需要使用requestOptions

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

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

关键的事情是,只要您在connected account上操作而不是自己创建帐户,例如创建费用,付款,在关联帐户上创建客户,就需要传递Stripe-Account标头。

答案 1 :(得分:0)

如果您要从平台创建用于连接帐户外部帐户的付款,则可能无法直接完成。首先从平台余额中发送资金,以使用转账api连接帐户。 transfer api

,然后在连接帐户上创建支出。通常,付款是自动的,并且在预设的最小天数(美国2天)之后,将使用关联帐户余额中的所有可用余额创建付款。

相关问题