gpt4 book ai didi

c# - 支付给用户外部账户的银行账户给出 'No such External Account...'

转载 作者:太空宇宙 更新时间:2023-11-03 14:45:37 25 4
gpt4 key购买 nike

我有一个非常令人沮丧的问题,Stripe 的文档/客户服务一直在为我提供解决方案,但我的问题仍未解决。

我正在尝试在 C# 中以编程方式向用户的银行账户实现支付。

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

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

  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 是我从 userCustomAccount.ExternalAccounts 检索到的 ID(like ba_xxxx)

我在尝试调用付款时收到一条错误消息,提示“不存在此类外部帐户”

知道如何解决这个问题吗?我不明白为什么这很难做到,为什么给我带来这么多麻烦。

谢谢!

最佳答案

由于您正在从您的平台帐户创建支付到连接的帐户,您将需要使用Stripe-Account header

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

在 C# 中,您需要使用 requestOptions

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

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

关键是当你在你的connected account上操作时,除了创建账户本身,比如创建charge, payout, creating customer on connected account,你需要通过 Stripe-Account header 。

关于c# - 支付给用户外部账户的银行账户给出 'No such External Account...',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54341152/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com