Beginner
How to test payments with cards on Stripe
Quick Answer
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
1
Enable Test Mode in Stripe Dashboard
Log into your Stripe Dashboard and ensure you're in Test mode by checking the toggle in the top left corner. When in test mode, you'll see a TEST DATA banner at the top of your dashboard. Test mode allows you to simulate payments without processing real transactions or charges.
Tip
Always verify you're in test mode before running payment tests to avoid accidental real charges.
2
Use Stripe's Test Card Numbers
Use Stripe's provided test card numbers for different scenarios. For successful payments, use
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.Tip
Bookmark Stripe's test card documentation page for quick access to all available test card numbers.
3
Test Declined Payments
To test declined payments, use specific test card numbers that simulate different decline reasons. Use
4000000000000002 for generic declines, 4000000000000069 for expired card errors, or 4000000000000127 for incorrect CVC failures. These help you test your error handling logic.Tip
Test multiple decline scenarios to ensure your application handles all possible error states gracefully.
4
Create a Test Payment Intent
In your Stripe Dashboard, navigate to Developers > API logs to monitor test transactions. You can also use the Payments section to view all test payments. Create a payment using your application or Stripe's API with the test card numbers to generate test payment intents.
Tip
Use the API logs to debug any issues with your payment integration in real-time.
5
Test 3D Secure Authentication
Use
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.Tip
Always test 3D Secure flows as they're required for many European transactions under PSD2 regulations.
6
Verify Webhooks with Test Events
Go to Developers > Webhooks in your Stripe Dashboard and check that your webhook endpoints are receiving test events. Use the Send test webhook button to manually trigger webhook events and verify your application processes them correctly.
Tip
Set up webhook endpoint monitoring to ensure your application reliably receives and processes payment events.
7
Review Test Payment Data
Navigate to Payments in your Stripe Dashboard to review all test transactions. Check payment status, amounts, metadata, and any error messages. Use the search and filter options to find specific test payments. Click on individual payments to view detailed transaction information.
Tip
Use metadata to tag test payments with specific test scenarios for easier identification and debugging.
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.Ready to get started with Stripe?
Put this tutorial into practice. Visit Stripe and follow the steps above.
Visit Stripe →