Split Card Elements
Use separate elements for card number, expiry date, and CVC for full control over your payment form layout.
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 enter the test card 4242 4242 4242 4242, any future expiry date and any CVC across the three fields. 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 one
VueStripeElementsgroup, the demo rendersVueStripeCardNumberElement,VueStripeCardExpiryElementandVueStripeCardCvcElementin its own layout. Each emitsreadyandchange; the demo shows each field's validation error under that field. - The Pay button is enabled once all three elements are ready and none reports an error.
- The button gets the card number element with
getElement('cardNumber')fromuseStripeElements()and callsconfirmCardPayment(clientSecret, { payment_method: { card } })fromuseConfirmCardPayment(). Stripe.js reads the expiry date and CVC from the other two elements in the same group, and opens 3D Secure when the card requires it. - When the PaymentIntent status is
succeeded, the demo shows the PaymentIntent ID.
See also
How-to guide: Accept card payments with the Card Element. Reference: Split Card Elements.
