let tok = await stripe.tokens.create({
card: {
number: '4242424242424242',
exp_month: 12,
exp_year: 2020,
cvc: '123'
}
})
tok
允许我一次性收费。接下来我想为以后的收费创建一个客户令牌,API是
const customer = await stripe.customers.create({
source: 'tok_mastercard',
email: 'paying.user@example.com',
});
然而,我不清楚我应该投入什么
source
,假设
是形式的
const tok = {
"id": "tok_1DHGtNDubJ4bIrUdqXvAGo4m",
"object": "token",
"card": {
"id": "card_1DHGtNDubJ4bIrUd2OyUHWNw",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"cvc_check": null,
"dynamic_last4": null,
"exp_month": 8,
"exp_year": 2019,
"fingerprint": "rhpDLcuYn3stjjKR",
"funding": "credit",
"last4": "4242",
"metadata": {},
"name": "Jenny Rosen",
"tokenization_method": null
},
"client_ip": null,
"created": 1538598261,
"livemode": false,
"type": "card",
"used": false
}
来源
tok.id
或
tok.card.id
托克
完全?