[英]How to retrieve card information such as card number with react-stripe-js?
我有
const stripeResponse = await stripe.confirmCardSetup(client_secret, {
payment_method: {
card: elements.getElement('cardNumber'),
billing_details: {
address: {
city: selectedAddress.town,
country: selectedAddress.country.iso3166Code,
line1: selectedAddress.line1,
line2: selectedAddress.line2,
postal_code: selectedAddress.postalCode,
state: selectedAddress.region,
},
email: 'ppp@mail.com',
name,
phone: selectedAddress.phone,
},
},
});
有了這個我確認卡設置,我在反應組件中使用 react-stripe-js:
import { CardNumberElement } from '@stripe/react-stripe-js';
//some component code below
...
<CardNumberElement options={options} />
...
無法從CardNumberElement
組件中獲取卡號。
如何獲得帶條紋的卡號?
您無法從 Stripe 獲取卡號。 這就是您需要使用 Stripe 庫的重要原因,這樣卡片的詳細信息就不會影響您的集成。
完整的原始卡號永遠不會在來自 Stripe 的 API 響應中公開: https://stripe.com/docs/security/guide
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.