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

Joh*_*ews 5 javascript payment node.js stripe-payments stripe-connect

我正在尝试设置 Stripe Connect 并且需要

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

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

即让我们假设以下电子邮件对应于帐户持有人:

admin@admin.com
Run Code Online (Sandbox Code Playgroud)

现在,我们有两个卖家:

seller_1@sellers.com
admin@admin.com
Run Code Online (Sandbox Code Playgroud)

我们有一位买家:

buyer_1@buyers.com
Run Code Online (Sandbox Code Playgroud)

我的代码在buyer_1seller_1. 一切顺利,并收取申请费。

然而,当buyer_1想要从admin@admin.com. 尽管admin@admin.com已连接到帐户平台(我经历了与 for 相同的过程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"
Run Code Online (Sandbox Code Playgroud)

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

// 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
  }
);
Run Code Online (Sandbox Code Playgroud)

Joh*_*ews -1

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

您可以在此处找到Stripe Connect 与 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-其他的