Skip to main content
  1. Home
  2. Blog
  3. Recharge API
  4. Testing a Recharge API in Sandbox: What to Check Before You Go Live

Testing a Recharge API in Sandbox: What to Check Before You Go Live

Developer testing recharge API responses on a laptop in sandbox mode

The first version of a recharge integration nearly always works for the happy path. You send a request, the reply says Success, the wallet goes down. The trouble starts with the cases nobody tested: a recharge that stays pending for a minute, a callback that arrives before your database has saved the order, a retailer who taps the button twice.

A sandbox, or test mode, lets you produce those cases on purpose, without a single rupee leaving your wallet. This is the checklist we suggest to every developer before they switch to the live API.

How A1Topup's sandbox works

Our test mode uses the same parameters and reply formats as the live API. Only the path changes, from /recharge/ to /sandbox/. Nothing is sent to the operator, and the balance call always returns a fixed test balance.

You choose the result with the last digit of the mobile number:

Last digitReplyCallback
0 to 6SuccessSuccess, right after the reply
7PendingFailure, after about a minute
8PendingSuccess, after about a minute
9FailureFailure, right after the reply

Sandbox calls work from any IP, so you can test from your own laptop. The live API only accepts your whitelisted server IP. Full details are in the API documentation.

The 8 tests worth running

1. A plain success

Check that you store the A1Topup transaction ID and the operator ID from the reply. Your support team will need the operator ID the first time a customer says "my recharge did not come".

2. A clear failure

The retailer's wallet should be refunded at once, and the screen should say the recharge failed, not "something went wrong".

3. Pending that ends in success

This is the most important test. Your system must not refund, and must not resend. It should show "processing" and wait for the callback or a status check.

4. Pending that ends in failure

The refund should happen only when the final Failure arrives, and only once, even if both the callback and your status check report it.

5. The same order ID twice

Each order ID can be used once. Send a duplicate and confirm your code treats the Failure reply as a duplicate, not as a failed recharge that needs a refund.

6. An amount below the minimum

Amounts below ₹10 return a Failure. Better still, stop them on your own screen before the request is sent.

7. A slow network

Use a 60-second timeout. A timeout should be treated as pending, never as failed. Then check the status with the same order ID.

8. Callback before the reply

On a fast success the callback can reach your server almost together with the reply. Make sure your callback code can find the order and does not crash or create a second record.

Tip: log every request, reply and callback with the time, in your own database. When a dispute comes later, those logs settle it in minutes.

Before you switch to live

  • Whitelist your server IP in the API panel
  • Change the path from /sandbox/ back to /recharge/
  • Do one real ₹10 recharge on your own number
  • Keep the sandbox code path for future releases, so every new version gets the same tests

Our guides on reply status codes and callback URLs in PHP go deeper into steps 3, 4 and 8.

Want to try it?

Ask for API access and you can start testing in the sandbox the same day. Message us on WhatsApp.

Frequently asked questions

What is a recharge API sandbox?
A test mode that accepts the same requests as the live API but never sends anything to the operator or moves money, so you can test success, pending and failure safely.
How do I get a pending result in A1Topup sandbox?
Use a mobile number ending in 7 (pending, then failure) or 8 (pending, then success). The callback arrives after about a minute.
Do I need a whitelisted IP for the sandbox?
No. Sandbox calls work from any IP. The live API needs your whitelisted server IP.

Have a question? Talk to our team

We respect your privacy. Your details are only used to contact you about A1Topup.

Related articles

WhatsApp