Stripe Connect Charge-必须作为连接帐户进行身份验证才能使用客户参数

Stripe Connect Charge - Must authenticate as a connected account to be able to use customer parameter

本文关键字:身份验证 参数 客户 Charge- Connect 连接 Stripe      更新时间:2024-03-23

我正在尝试设置Stripe Connect,需要

  1. 通过首先创建客户向买方收费
  2. 然后生成一个令牌,最后
  3. 用这个代币向客户收费

只要买方和卖方不是Stripe Connect平台的所有者,这就可以正常工作。

也就是说,假设以下电子邮件对应于账户持有人:

admin@admin.com

现在,我们有两个卖家:

seller_1@sellers.com
admin@admin.com

我们有一个买家:

buyer_1@buyers.com

buyer_1seller_1购买时,我的代码可以工作。一切顺利,并收取申请费。

然而,当buyer_1想要从admin@admin.com购买时,问题就出现了。即使admin@admin.com连接到帐户平台(我经历了与seller_1相同的过程),我仍然会得到错误:

message: "Must authenticate as a connected account to be able to use customer parameter. See https://stripe.com/docs/api#create_card_token for more details."
param: "customer"
raw: Object
rawType: "invalid_request_error"
requestId: "req_8EtIue0F4JWFmQ"
stack: 400
type: "StripeInvalidRequestError"

我使用以下教程来保存客户并向客户收费:

// store
// Set your secret key: remember to change this to your live secret key in production
// See your keys here https://dashboard.stripe.com/account/apikeys
var stripe = require("stripe")("SECRETKEY");
// (Assuming you're using express - expressjs.com)
// Get the credit card details submitted by the form
var tokenID = request.body.stripeToken;
// Create a Customer
stripe.customers.create({
  source: tokenID,
  description: "Example customer"
}, function(err, customer) {
});
// Create token
// Create a Token from the existing customer on the platform's account
stripe.tokens.create(
  { customer: CUSTOMER_ID, card: CARD_ID },
  { stripe_account: CONNECTED_STRIPE_ACCOUNT_ID }, // id of the connected account
  function(err, token) {
    // callback
  }
);

我知道这个问题不是最近才出现的,但在我的开发测试中我已经多次遇到同样的问题。这个问题在我做数据库时得到了修复:重置或删除用户(客户帐户)并重新授权。

原来,对于旧计划,我有相同用户的重复连接帐户,并且api_key是旧的。

由于我正在进行开发和测试,我还发现在仪表板>业务设置>数据>删除所有测试数据上清除Stripe中的测试数据很有用

希望能有所帮助。

同样的事情也发生在我身上。这有点欺骗性,因为Stripe让你在设置中直接将你的帐户连接到同一个帐户(上面写着"测试OAuth流"),就像一个帐户同时充当平台和连接的帐户一样。但是,当您试图在连接的帐户上实际创建费用或客户时,会出现上述错误。

我在使用Stripe Connect测试充电时遇到了这个问题。事实证明,当我完成将测试业务连接到我的应用程序的过程时(通过他们提供的Connect to Stripe测试页面),我也已经在另一个浏览器窗口中登录到了我应用程序的Stripe帐户。这最终将我的应用程序的帐户数据保存在了新的"测试业务"的位置,该业务不断导致收费失败。

当我从Stripe注销时也经历了同样的过程,它运行良好,收费处理正常。

答案是简单地将客户id更改为客户,并将卡更改为来源。

你可以在这里找到一个工作示例Stripe Connect with Ionic的完整源代码:

https://www.noodl.io/market/product/P201601151251248/stripe-connect-guide-with-complete-source-code-all-you-need-to-start-accepting-money-on-behalf-of-others