How to test payments with cards on Stripe
Test payments on Stripe by using their test card numbers in test mode, which allows you to simulate various payment scenarios without processing real money. You can test successful payments, declined cards, and specific error conditions using Stripe's provided test card numbers.
Prerequisites
- Stripe account
- Access to Stripe Dashboard
- Basic understanding of payment processing
- Test mode enabled in your Stripe account
Step-by-Step Instructions
Enable Test Mode in Stripe Dashboard
Use Stripe's Test Card Numbers
4242424242424242 (Visa) or 5555555555554444 (Mastercard). Use any future expiration date, any 3-digit CVC, and any billing ZIP code. These cards will always result in successful payment processing.Test Declined Payments
4000000000000002 for generic declines, 4000000000000069 for expired card errors, or 4000000000000127 for incorrect CVC failures. These help you test your error handling logic.Create a Test Payment Intent
Test 3D Secure Authentication
4000000000003220 to test 3D Secure authentication flows. This card will trigger the authentication process, allowing you to test how your integration handles additional customer verification steps. Complete the authentication challenge when prompted to simulate successful authentication.Verify Webhooks with Test Events
Review Test Payment Data
Common Issues & Troubleshooting
Test card number not working
Ensure you're in Test mode and using valid Stripe test card numbers. Real card numbers will not work in test mode, and test card numbers won't work in live mode.
Payment Intent creation failing
Check your API keys are correct test keys (starting with pk_test_ and sk_test_). Verify your request format matches Stripe's API documentation and includes required parameters like amount and currency.
Webhooks not receiving test events
Verify your webhook endpoint URL is publicly accessible and returns a 200 status code. Check your webhook signing secret is correctly configured and that your endpoint can handle Stripe's webhook format.
3D Secure test not triggering
Ensure you're using the correct 3D Secure test card numbers like 4000000000003220. Check that your payment flow is configured to handle authentication challenges and redirect URLs properly.