What Stripe test card numbers are and why you need them
Stripe test card numbers are fake credit card numbers that Stripe provides for developers to test payment flows without charging real money or using real cards. When you're building a payment system with Stripe, you use these test numbers in your development environment to simulate transactions, test error handling, and verify that your checkout works before going live.
Stripe separates your account into two modes: test mode and live mode. Test mode lets you process transactions using test card numbers without touching actual customer funds. Live mode is where real payments happen. You switch between them using separate API keys, so there's no risk of accidentally charging a test card to a real customer.
Every Stripe account comes with test card numbers built in. You don't need to request them or set them up—they're ready to use when ready in your test environment.
Key Takeaways
- Stripe provides specific test card numbers for different scenarios: basic approval, decline, and 3D find authentication testing.
- Test cards only work in test mode using your test API keys; they will fail if you try to use them in live mode.
- The most common test card is 4242 4242 4242 4242, which simulates a successful charge with any future expiration date and any three-digit CVC.
- Stripe includes test cards that trigger specific responses—like declined payments or authentication requirements—so you can test how your app handles different outcomes.
- Test transactions appear in your Stripe dashboard under test mode, separate from live transactions, so you can review them without affecting real payment records.
The most common Stripe test card numbers
The card number 4242 4242 4242 4242 is the standard test card for a successful payment. Use it whenever you want a transaction to go through without errors. The expiration date can be any date in the future—many developers use 12/25 or 12/99 for simplicity. The CVC (the three-digit security code on the back) can be any three digits.
If you need to test a declined payment, use 4000 0000 0000 0002. This card will always be declined with the error code "card_declined". It's useful for testing how your checkout handles payment failures—whether your error message displays correctly, whether the user can retry, and whether your system logs the failure properly.
For testing 3D find authentication (the extra verification step some cards require), use 4000 0025 0000 3155. This card will trigger a 3D find prompt during checkout, letting you verify that your integration handles the authentication flow correctly.
Stripe also provides test cards for specific card brands. Use 5555 5555 5555 4444 to test Mastercard, 3782 822463 10005 for American Express, and 6011 1111 1111 1117 for Discover. These behave like the basic 4242 card—they approve successfully—but they let you confirm your system handles different card types correctly.
How to use test cards in your Stripe dashboard
Open your Stripe dashboard and make sure you're in test mode. You'll see a toggle in the top left corner that says "Test data" or shows a test/live indicator. If you're in live mode, switch to test mode first.
Navigate to the Payments section and look for a way to create a test payment manually, or use your development environment to process a payment through your code. Enter one of the test card numbers above, set any future expiration date, and use any three-digit CVC. Submit the payment.
The transaction will process when ready and appear in your Payments list under test mode. Click into the transaction to see the full details: the card number, the amount, the timestamp, and the status. This is where you verify that your payment flow is working as expected before you connect real cards.
Test transactions never charge anyone and never appear on a real credit card statement. They exist only in your test environment and are clearly marked as test data in your dashboard.
Test cards for specific error scenarios
Stripe provides test card numbers that trigger specific errors, so you can test how your app responds to different failure modes. These are useful for building robust error handling.
4000 0000 0000 0069 triggers an "expired_card" error, simulating a payment with an expired card. 4000 0000 0000 0127 triggers an "incorrect_cvc" error. 4000 0000 0000 0010 triggers a "processing_error", which simulates a temporary problem on Stripe's side.
Use these cards to test that your checkout displays the right error message for each scenario, that users can correct their information and retry, and that your backend logs the failure correctly. Testing error paths is as important as testing the happy path—most real-world issues happen when something goes wrong, not when everything works.
The difference between test mode and live mode
Your Stripe account has two completely separate environments. Test mode uses test API keys and test card numbers. Live mode uses live API keys and real credit cards. The two never mix.
In your code, you specify which API key to use. If you use your test secret key, Stripe processes the request in test mode and only accepts test card numbers. If you use your live secret key, Stripe processes the request in live mode and only accepts real cards. If you try to use a test card number in live mode, it will be declined.
Your Stripe dashboard shows test and live data separately. When you're in test mode, you see only test transactions. When you switch to live mode, you see only real transactions. This separation prevents confusion and makes it clear which payments are real.
Before you go live, make sure you've switched your code to use your live API keys and removed all test card numbers from your checkout. Many developers keep test cards in a separate branch or configuration file to make the switch easier.
Common mistakes when testing with Stripe cards
The most common mistake is forgetting to switch to test mode before testing. If you're in live mode and you try to use a test card number, it will be declined. Check the test/live toggle in your dashboard before you start testing.
Another mistake is using the wrong API key in your code. If you're trying to test but you're using your live secret key, test cards won't work. Make sure your development environment is configured to use your test secret key, not your live key.
Some developers test with real card numbers to "make sure it works". Don't do this. Test cards exist specifically so you don't have to. Using real cards in test mode is unnecessary, and using real cards in live mode before you're ready can cause problems.
Finally, don't hardcode card numbers into your code. Use test cards only during development and testing. When you deploy to production, make sure you're using live mode and real cards are being entered by actual customers through your checkout form.
Frequently Asked Questions
Can I use test card numbers in live mode?
No. Test card numbers are rejected in live mode. If you try to use 4242 4242 4242 4242 in live mode, it will be declined. This is a safety feature—it prevents accidental test transactions from being charged to real customers.
Do test transactions show up on my Stripe bill?
No. Test transactions don't cost anything and don't appear on your invoice. They exist only in your test environment. You can run as many test transactions as you need without any charge.
What expiration date should I use with test cards?
Any date in the future works. Many developers use 12/25, 12/99, or the current month and year plus one. Stripe doesn't validate the expiration date on test cards, so any future date will be accepted.
Can I test refunds with test card numbers?
Yes. After you process a test payment, you can refund it just like you would a live payment. The refund will appear in your test dashboard and won't charge anything. This is useful for testing your refund flow before going live.
What if I need to test a specific country or currency?
Test cards work with any currency and any country. The card number itself doesn't change—you specify the currency and country in your payment request, not in the card number. Use the same test cards and adjust the currency and location in your code.