The short answer: enter 4111 1111 1111 1111 on the Razorpay checkout, pick any expiry date in the future, type any three digits for the CVV, and enter 1234 as the OTP. The payment goes through and you get a payment id back. The one hard requirement is that your integration is running on a test key, the one that starts with rzp_test_. A test card on a live key will simply fail, and that is by design.
Test numbers that work
These are the numbers Razorpay publishes for test mode. They are public and worthless outside a sandbox, so don't treat them as secrets.
- 4111 1111 1111 1111 (Visa)
- 5267 3181 8797 5449 (Mastercard)
- 5555 5555 5555 4444 (Mastercard)
- 5104 0600 0000 0008 (Mastercard)
- 4012 8888 8888 1881 (Visa)
Any of these will produce a successful authorization when the rest of the form is filled in correctly. Card networks also publish their own generic sandbox ranges, but mixing them in usually causes confusion because the gateway decides which numbers it accepts.
The other fields
- Expiry: any month and year later than today. A past date triggers an expiry failure, which is handy when you want to test that path.
- CVV: any three digits. Four digits for Amex-style numbers.
- Name: anything. It is not validated against the card.
- OTP: 1234 for success. Anything else fails the 3DS step, which is the cleanest way to simulate an authentication failure.
Test mode is a separate world
Test keys and live keys do not overlap. Payments made in test mode never touch a bank, never move money, and never appear in your settlement reports. The dashboard shows them under a test toggle so you can inspect the flow without polluting your real numbers. Flip the key, and the same card number becomes invalid.
One habit worth building early: keep the test key in your local environment file and never let it reach production config. I have seen staging builds ship with a live key because someone swapped a single line before a demo.
Triggering failures on purpose
A test suite that only covers the happy path is not a test suite. Cover the boring cases:
- Enter a wrong OTP to simulate a failed 3DS authentication.
- Use an expiry date in the past.
- Cancel the checkout modal halfway through and check that your order stays pending rather than marked paid.
- For UPI, Razorpay provides
success@razorpayandfailure@razorpayvirtual IDs that behave as their names suggest.
Razorpay's test card documentation lists additional numbers tied to specific decline reasons such as insufficient funds. Check that page whenever a scenario you need is missing here.
Where integrations usually break
The card is rarely the problem. The signature check on the callback is. Razorpay signs the payment response with your key secret, and if you skip verification you will mark orders paid on nothing more than a browser redirect. Verify the signature server side, then confirm the captured amount against your own order record before you ship anything.
Second most common: webhooks firing in test mode while your endpoint only exists in production. Point the webhook URL at a tunnel during development or you will discover the gap on launch day.
Third: real card data in the test form. Never do it. Test environments are not built to hold cardholder data, and using a live card there can get your merchant account flagged.
Before you switch to live keys
- Signature verification tested with a tampered payload.
- Webhook retries handled without creating duplicate orders.
- Failure states surfaced to the user with a clear message.
- Refund and partial refund flows exercised in test mode.
- Test card numbers and test keys removed from every shipped build.
Once those hold, swapping in the live key is the easy part. The test card did its job the moment it proved your code handles both outcomes.