如何使用stripe.js为新客户创建令牌

时间:2015-10-29 04:16:11

标签: javascript node.js stripe-payments

Stripe文档说明以下代码可用于创建新客户。

stripe.customers.create({
  description: 'Customer for test@example.com',
  source: "tok_16cz9QDmMHdxsE7ezNjoLsUM" // obtained with Stripe.js
}, function(err, customer) {
  // asynchronously called
});

但是Stripe.js没有说明如何为客户创建令牌。有没有人知道如何为新客户创建令牌?

1 个答案:

答案 0 :(得分:2)

Yes, it does;文档明确指出,基于客户的令牌创建仅适用于Stripe Connect,并且只能与OAuth访问令牌或Stripe-Account标头一起使用。"在该上下文中,您可以传递customer属性。在任何其他情况下,您只能基于卡片或银行帐户创建令牌。