How the page works
The page receives aclient_secret query parameter set by the plan selection step. This secret is tied to a specific PaymentIntent created when the subscription was initiated.
Stripe Elements is initialized
The
<Elements> provider is mounted with your Stripe publishable key via loadStripe. The clientSecret is then passed directly as a prop to the <CardSubscription> component inside the provider.app/routes/subscribe.tsx
User enters card details
The
<CardElement> component renders a single, secure iframe-based input that collects the card number, expiry date, and CVC. Card data is tokenized client-side and never sent to your server.User submits the form
On submit, the form calls
stripe.confirmCardPayment with the clientSecret and the card element. A cardholder name is included in the billing details.app/components/cardsubscription.tsx
SCA / 3D Secure is handled automatically
If the card issuer requires additional authentication (SCA/3DS),
confirmCardPayment automatically presents the bank’s authentication dialog. No extra code is needed — Stripe manages the redirect or modal flow and resolves the promise once authentication completes.Error handling
IfconfirmCardPayment returns an error (declined card, insufficient funds, failed authentication), the error message from Stripe is displayed inline on the payment form. The user can correct their details and try again without restarting the subscription flow.
Test cards
Use these card numbers in Stripe’s test mode to simulate different payment scenarios. Use any future expiry date, any 3-digit CVC, and any postal code.| Card number | Behavior |
|---|---|
4242 4242 4242 4242 | Payment succeeds immediately |
4000 0025 0000 3155 | Requires SCA / 3D Secure authentication |
4000 0000 0000 9995 | Payment is declined (insufficient funds) |
4000 0000 0000 0002 | Payment is declined (generic decline) |
Security
PCI compliance
Card details are collected inside a Stripe-hosted iframe (
CardElement). Raw card data never touches your application server.SCA / 3DS
confirmCardPayment handles the full Strong Customer Authentication flow required by regulations such as PSD2 in Europe.