OOmnistu

Blog / Web & Ecommerce

Web & Ecommerce

Testing online payments safely: how test mode works (Razorpay as an example)

Use Razorpay's documented test-mode behavior to plan payment success, failure and retry checks without real customer payment data.

OOmnistu
Reviewed 2026-11-16 · 2 min read

Before real customers pay on your site or app, you need to prove the payment flow works. Payment providers offer a test mode for this. Razorpay's documentation (https://razorpay.com/docs/payments/payments/test-card-details/) is a clear example. Other providers work on similar ideas but have their own rules, so read yours.

What Razorpay's documentation says about test mode

Check the page for the current card list rather than copying numbers from an article.

What to test

Scenario What you want to see
Successful payment Order confirmed, receipt created, stock reduced once
Failed payment Clear unpaid/failed state; no paid fulfillment, even if an order record already exists
Timeout or slow bank No duplicate order if the customer retries
Customer closes the page mid-payment The order status ends in a clear state after the provider notifies you
Refund Amount and status match

The scenarios and expected results are our checklist. Use the provider's error-simulation cards for the failure rows.

Rules for safe testing

  1. Use test keys and test cards only in test environments. Never use a real customer's card or order data to test.
  2. Keep test and live keys separate, stored outside the code repository, and make it impossible for the test app to use live keys.
  3. Switch to live mode deliberately, with a checklist: live keys, webhook URLs, success and failure pages. Check your provider's terms and your own policies before any live transaction; this article gives no advice on real-money test payments.
  4. Confirm results on the server. The browser saying "paid" is not proof; check with the provider's server-side confirmation.

Limits

This article does not cover fees, settlement times, compliance or legal duties. Those depend on your provider and your country. The test-mode behaviours above are Razorpay's as documented on the page we read.

By Omnistu.

Sources

Previous
Lazy-loading images without delaying your main content