Stripe Connect 费用 - 必须验证为连接帐户才能使用客户参数

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

我正在尝试设置 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"

我用下面的教程来save a customer and charge customers

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

同样的事情发生在我身上。这有点具有欺骗性,因为 Stripe 让您可以将您的帐户直接连接到设置中的同一个帐户(其中显示 "test the OAuth flow"),就像一个帐户既充当平台又充当连接的帐户一样。但是,当您尝试在连接的帐户上实际创建费用或客户时,您会收到上述错误。

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

您可以在此处找到 Stripe Connect with Ionic 的工作示例 complete source code

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

我知道这个问题不是最近出现的,但我在开发测试中多次遇到同样的问题。 当我执行 db:reset 或删除用户(客户帐户)并重新授权时,问题已解决。

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

由于我是做开发和测试的,我也发现清除Stripe中的测试数据很有用,在仪表盘>业务设置>数据>删除所有测试数据

希望对您有所帮助。

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

当我通过相同的过程退出 Stripe 时,它​​工作正常并且费用处理正常。