我正在尝试设置 Stripe Connect 并且需要
- 通过首先创建客户来向买方收费,
- 然后生成一个令牌,最后
- 使用此令牌向客户收费。
只要买卖双方不是 Stripe Connect 平台的所有者,这种方法就可以正常工作。
即假设以下电子邮件对应于帐户持有人:
admin@admin.com
现在,我们有两个卖家:
seller_1@sellers.com
admin@admin.com
我们有一个买家:
buyer_1@buyers.com
我的代码在buyer_1
从seller_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"
我使用以下教程来保存客户并向客户收费:
// 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
}
);