Getting started
Sandbox and test numbers
Requests made with a test key run through the same API, validation and webhooks as live ones, but never reach a network or biller.
The sandbox address
Build and test against https://sandbox.paysef.com/api/v1 with your test key (pays_test_…). It is the same API as https://api.paysef.com/api/v1, with the same account, keys and webhooks, on an address that takes test keys only.
| Sent to the sandbox address | Result |
|---|---|
| A test key | Works as usual, from your test wallet. |
| A live key, or no key | HTTP 403 SANDBOX_TEST_KEY_REQUIRED, so a pasted live key can never move real money there. Use api.paysef.com with a live key. |
The key, not the address, decides whether an order is a test. Test keys also work on api.paysef.com, so an integration that already tests there keeps working. When you go live, change both the base URL and the key; see Going live.
The test wallet
Every account has a separate test wallet holding ₦900,000.00 of test funds. Purchases made with an pays_test_ key are paid from it, and GET /wallets/me returns its balance (available_balance_kobo, starting at 90000000) when called with a test key. You can reset it to ₦900,000.00 at any time from Developer settings in the app.
Test orders carry "is_test": true in responses and webhooks. Listing orders with a test key returns only test orders.
Which sandbox answers a test order
A test order never reaches a live network. Where it goes depends on the service:
- The network's own sandbox, when one is set up for that service. The order, and
validatefor cable TV, electricity and exam PINs, go to the provider's test environment, and its test numbers decide the outcome. Statuses, wallet effects and webhooks follow the same rules as live orders, but only your test wallet moves, and a pending order settles when the sandbox confirms it. - The last-digit simulation, otherwise. The table below applies.
Choose the outcome with the last digit
When no network sandbox serves the service, the last digit of the recipient (phone number, smartcard number or meter number) decides what the simulated provider does:
| Last digit | Outcome | Response | Webhook |
|---|---|---|---|
| 1 | Fails immediately | HTTP 422, FAILED_UNRESERVED | order.failed |
| 2 | Pending, then succeeds after about 3 seconds | HTTP 202, then SUCCESS_SETTLED | order.success |
| 3 | Pending, then fails after about 3 seconds and the test funds are released | HTTP 202, then FAILED_UNRESERVED | order.failed |
| 0, 4-9 | Succeeds immediately | HTTP 200, SUCCESS_SETTLED | order.success |
The rule applies to bulk orders too, recipient by recipient. Successful test orders return sample delivery details so you can test how you display them:
| Service | Sample fields on a successful test order |
|---|---|
| Electricity | token 4829-1049-3829-4012-9910 and units 45.2 kWh |
| Exam PINs | token and pin PIN-9482019283, serial_number SER-0019283 |
| Airtime, data, cable TV | No token, as in live mode. |
Validation in test mode
The cable TV, electricity and exam PIN validate endpoints take the sku you are about to buy, as in live mode. When no network sandbox serves the service they are simulated: a smartcard number, meter number or JAMB profile ID ending in 1 returns "is_valid": false with an error_message such as Simulated sandbox meter validation failure (ends with 1). Any other number is valid and returns the customer name TEST SANDBOX CUSTOMER (and, for meters, customer_address 12 Sandbox Avenue, Lagos and meter_type PREPAID). For exam PINs the valid name is TEST SANDBOX CANDIDATE.
What works exactly as in live mode
- The catalogue, prices for your account type and request validation.
- Idempotency keys and the duplicate guard.
referenceuniqueness. References are shared between test and live, so a reference used in a test order cannot be used again in live.- Webhooks, signed with your normal webhook secret, with
is_test: true. They go to the webhook URL of Test mode in Developer settings, or to your live webhook URL if you have not set a test one.
Differences from live mode
Test orders do not create wallet ledger entries, so GET /transactions always shows your live wallet; use GET /vtu/orders to list test orders. Test keys cannot fund a wallet, so wallet.funded is live only. If the test wallet runs out you get INSUFFICIENT_BALANCE; reset it in the app.