"Cannot create payouts with an OAuth key" 为 Stripe 自定义帐户创建付款时出现异常

"Cannot create payouts with an OAuth key" exception when creating payout for Stripe custom account

我们有我们的主 Stripe 账户,以及我们最终想要将资金转入的自定义/关联账户,然后支付到他们的外部银行账户。

我有一些代码在测试模式下没有问题,但在生产环境中,我们在执行支付步骤时遇到异常。错误详细信息是:

Stripe.StripeException: Cannot create payouts with an OAuth key.
at Stripe.Infrastructure.Requestor.ExecuteRequest(HttpRequestMessage requestMessage)
at Stripe.Infrastructure.Requestor.PostString(String url, StripeRequestOptions requestOptions)

据我所知,我们没有为此请求使用 OAuth 密钥,因为我在 Startup.cs 中使用密钥设置了 StripeAPI MVC 网络应用程序:

StripeConfiguration.SetApiKey("sk_live_**************"); 

以及尝试支付的实际代码:

StripePayoutService sps = new StripePayoutService();

StripeRequestOptions connectRequest = new StripeRequestOptions();
connectRequest.StripeConnectAccountId = stripeConnectID; //"acct_*********"

StripePayoutCreateOptions spco = new StripePayoutCreateOptions();            
spco.Amount = (int)(amount * 100);
spco.Currency = "GBP";
spco.StatementDescriptor = reference;

StripePayout result = sps.Create(spco, connectRequest);        

我已经在条带请求选项和 Api 初始化中指定了连接的帐户 ID,那么是什么导致请求抱怨 OAuth 凭据,或者我错过了什么/做错了什么这个场景?

结果是由于边缘情况,因为使用了错误的 Stripe 密钥,所以 OAuth 密钥错误消息是一个红色鲱鱼。我建议任何调查与此类似的问题的人检查:

  • Stripe 仪表板上 api/logs 部分中的请求详细信息(通过请求 ID),并且存在针对相应 Stripe 帐户的请求
  • 在请求付款之前,有足够的资金/转账成功

你没有做错任何事。其完全正确的可用支付金额在连接帐户的测试数据中不可用。进行测试交易并将金额添加到条纹测试帐户。它应该可以正常工作。