[英]How to create discrete inputs for credit card information with the Vue Stripe Checkout library?
[英]Stripe: how to create a customer object given credit card information
假設客戶提供了信用卡信息,那么我可以創建一個一次性收費對象:
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
什么,假設tok
是形式
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
}
然后是source
tok.id
或tok.card.id
,還是信息甚至在tok
中?
基於https://stripe.com/docs/api/customers/create 。
Source is a Token’s or a Source’s ID, as returned by Elements
因此,在您的情況下,源是tok.id
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.