What Stripe card testing means
Stripe card testing is the process of running payment flows in Stripe test mode with card numbers Stripe publishes for developers. Test cards behave like real cards inside the sandbox. They return approvals, declines, and authentication challenges, but no money moves and no cardholder is charged. Use them to confirm your integration works before you switch to live keys.
Do not confuse this with the fraud tactic that shares the name. Stripe test numbers only resolve in test mode. A live key rejects them, and the same is true for any card number you did not get from Stripe.
Prerequisites
- A Stripe account with Dashboard access
- Your test mode publishable key and secret key
- A checkout form wired to Stripe.js or a server side PaymentIntent call
- Optional: the Stripe CLI if you want to forward webhooks to localhost
Steps
- Open the Stripe Dashboard and flip the Test mode switch in the top right. The header turns orange when test mode is active.
- Copy the test keys from the Developers section. Confirm both the publishable and secret keys start with the test prefix, not the live one.
- Load your checkout page and enter 4242 4242 4242 4242 as the card number. This Visa test card always succeeds.
- Enter any future expiration date, any three digit CVC, and any postal code. Test mode accepts arbitrary values for those fields.
- Submit the payment. Confirm your success handler fires and the PaymentIntent status reads succeeded.
- Repeat the flow with a decline card. Use 4000 0000 0000 0002 for a generic decline, 4000 0000 0000 9995 for insufficient funds, 4000 0000 0000 0069 for an expired card, and 4000 0000 0000 0127 for an incorrect CVC.
- Enter 4000 0025 0000 3155 to force a 3D Secure challenge. Your code must handle the redirect or modal and then complete the intent.
- Check the raw error object your server returns. Map each decline code, such as card_declined or incorrect_cvc, to a message your customer can act on.
- Run the Stripe CLI with the listen command and the forward to flag so test webhooks reach your local endpoint. Confirm you receive payment_intent.succeeded and payment_intent.payment_failed events.
- Swap in live keys only after every branch of the flow passes with test cards.
Reading the results
Stripe returns a decline code on failed test charges. Log the code, not just the display message. Chargebacks, disputes, and refund states also have test triggers, so you can rehearse those paths without touching real funds.
Common mistakes
- Testing against live keys. Test numbers fail there by design.
- Hardcoding card values into production code paths.
- Skipping authentication branches. A flow that ignores 3D Secure will break on real traffic.
- Leaving test data in a live database. Purge it before launch.