如何使用 stripe.js 为新客户创建令牌
how to create a token for new customer using stripe.js
Stripe 文档说以下代码可用于创建新客户。
stripe.customers.create({
description: 'Customer for test@example.com',
source: "tok_16cz9QDmMHdxsE7ezNjoLsUM" // obtained with Stripe.js
}, function(err, customer) {
// asynchronously called
});
但是Stripe.js没有说明如何为客户创建令牌。有人知道如何为新客户创建令牌吗?
Yes, it does;文档明确指出基于客户的令牌创建仅适用于 Stripe Connect 和 "can only be used with an OAuth access token or Stripe-Account header." 在这种情况下,您可以传递 customer
属性。在任何其他情况下,您只能基于卡或银行帐户创建令牌。
Stripe 文档说以下代码可用于创建新客户。
stripe.customers.create({
description: 'Customer for test@example.com',
source: "tok_16cz9QDmMHdxsE7ezNjoLsUM" // obtained with Stripe.js
}, function(err, customer) {
// asynchronously called
});
但是Stripe.js没有说明如何为客户创建令牌。有人知道如何为新客户创建令牌吗?
Yes, it does;文档明确指出基于客户的令牌创建仅适用于 Stripe Connect 和 "can only be used with an OAuth access token or Stripe-Account header." 在这种情况下,您可以传递 customer
属性。在任何其他情况下,您只能基于卡或银行帐户创建令牌。