Checkout Form Example
Stripe's complete checkout form as one element on this page. The server creates a Checkout Session with ui_mode: 'form'; VueStripeCheckoutFormProvider runs the Checkout Form SDK, VueStripeCheckoutForm renders the contact details, payment method, total and Pay button, and confirm() from useCheckoutForm() completes the payment when the form emits @confirm.
Beta
The Checkout Form is a Stripe beta. This demo runs on a Stripe account that has access; your account needs it too, otherwise the provider's #error slot shows Stripe's error instead of the form.
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 fill in the form. Pay with the test card 4242 4242 4242 4242, any future expiry date and any CVC. The demo ends with the Checkout Session ID.
Select a Product
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 Checkout Session with
uiMode: 'form'and a return URL to this page. The demo passes the Promise of the client secret straight toVueStripeCheckoutFormProvider. - The provider runs the Checkout Form SDK. Inside it,
VueStripeCheckoutForm(withlayout: 'expanded') renders the contact details, payment method, total and its own Pay button and wallet buttons. Itschangeevent reports whether the form is complete; the demo shows that next to the session total fromuseCheckoutForm(). - The Pay button and the wallet buttons make the form emit
confirmwith an event. The handler passes that event toconfirm({ formConfirmEvent: event, redirect: 'if_required' })fromuseCheckoutForm(). - On success, the result carries the session, and the demo shows its ID. A Stripe error is shown under the form instead.
- Payment methods that need a redirect return to this page with
?result=success, and a banner shows the result.
See also
How-to guide: Add the Checkout Form. Reference: VueStripeCheckoutForm and useCheckoutForm.
