How to Test Checkout Forms Without Real Card Data

By FormFiller Team
4 min read
E-commerce Testing Payments

You don't need a real credit card to test a checkout flow. Here's how Luhn-valid test numbers work, and which official Stripe and PayPal test cards to use instead.

Every checkout form eventually needs a card number typed into it. Using your own card gets old fast, and using a colleague's is worse. What you actually want is a number that looks real enough to pass your form's validation — right length, right prefix, right checksum — without being tied to any real account.

Why "4242 4242 4242 4242" works

Card numbers aren't random. Every network — Visa, Mastercard, Amex, Discover — reserves a prefix range and a fixed length, and every number ends in a check digit computed with the Luhn algorithm: double every second digit from the right, subtract 9 if the result is over 9, sum everything, and the total has to be a multiple of 10. Client-side form validation almost always stops at this check before a number ever reaches a payment processor.

That's exactly why Stripe's famous 4242 4242 4242 4242 works in test mode — it's a Visa-prefixed, Luhn-valid number. Any number built the same way will pass the same validation, which is the whole point of a test card generator.

Generate your own, or use the official ones

The Test Credit Card Generator produces fresh, Luhn-valid Visa, Mastercard, American Express, and Discover numbers on demand, each with a matching expiry date, CVV, and cardholder name. Use these for anything that only checks format — UI testing, demo data, QA fixtures, load testing a form's client-side validation.

For anything that talks to an actual payment processor's test environment, use their published numbers instead — the specific digits determine the simulated outcome. The same page also lists Stripe's and PayPal's official test cards: 4242 4242 4242 4242 for a successful Stripe charge, 4000 0000 0000 0002 for a generic decline, 4111 1111 1111 1111 for PayPal's sandbox, and more. Random Luhn-valid numbers won't trigger Stripe's or PayPal's specific test scenarios — you need their exact numbers for that.

Test the whole form, not just the card field

A checkout form is rarely just a card number. Pair the card generator with the Fake Address Generator for billing address fields, and the Fake Identity Generator for the cardholder's name, email, and phone — as covered in our guide to testing e-commerce checkout flows. Between the two, you can populate an entire checkout form with realistic, harmless data in seconds.

If you're doing this repeatedly, the FormFiller extension fills the non-card fields directly in the browser, so you only have to think about the one field you're actually testing. Free for Chrome and Firefox, and nothing leaves your machine.