Card Element
Accept card payments using the single-field Card Element. This is a legacy element that combines card number, expiry, and CVC into one input.
Try the demo
The demo runs in Stripe test mode against the demo backend at backend.vuestripe.com, so nothing is charged. Pick a product, then type the test card 4242 4242 4242 4242, any future expiry date and any CVC into the one card field. The demo ends with the PaymentIntent ID.
1Product
2Payment
Complete
0
Select a Product
Loading test products...
How the demo works
- The product step loads the demo account's one-time products from the backend.
- Choosing a product asks the backend to create a PaymentIntent for that product's price and returns its client secret.
- Inside
VueStripeProviderandVueStripeElements,VueStripeCardElementrenders one field for the card number, expiry date and CVC. Itschangeevent carries validation errors, which the demo shows under the field. The Pay button stays disabled until the element is ready and has no error. - The Pay button gets the mounted Card Element with
getElement('card')fromuseStripeElements(), then callsconfirmCardPayment(clientSecret, { payment_method: { card } })fromuseConfirmCardPayment(). Stripe.js opens 3D Secure in a modal when the card requires it. - When the PaymentIntent status is
succeeded, the demo shows the PaymentIntent ID.
The Card Element accepts cards only. The Payment Element demo shows the element Stripe recommends for new integrations.
See also
How-to guide: Accept card payments with the Card Element. Reference: VueStripeCardElement.
