> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mysubwallet.ng/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandbox & Test Mode

> Test your integration end-to-end without spending real money.

Test the entire API safely — every call is **simulated**, so nothing is charged and no service is delivered. There are two ways to switch into test mode:

<CardGroup cols={2}>
  <Card title="Sandbox URL" icon="link">
    Send your requests to **`https://sandbox.mysubwallet.ng`** with your normal API key.
  </Card>

  <Card title="Sandbox key" icon="key">
    Or use your **`sk_test_…`** key against the normal `https://api.mysubwallet.ng` URL.
  </Card>
</CardGroup>

Both behave identically. Your keys are on the **Pricing & Plan IDs** page of your [dashboard](https://app.mysubwallet.ng).

## Base URLs

| Environment    | Base URL                         | Effect                                                |
| -------------- | -------------------------------- | ----------------------------------------------------- |
| **Production** | `https://api.mysubwallet.ng`     | Real transactions — your wallet is charged.           |
| **Sandbox**    | `https://sandbox.mysubwallet.ng` | Test mode — simulated, **never** charges your wallet. |

## Example

Just point the request at the sandbox URL — everything else stays the same:

```bash theme={null}
curl -X POST "https://sandbox.mysubwallet.ng/api/data" \
  -H "Authorization: Token your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "network": 1,
    "phone": "2347013397088",
    "data_plan": 19,
    "request-id": "Test_1"
  }'
```

```json Sandbox response theme={null}
{
  "status": "success",
  "message": "[SANDBOX] Test transaction successful. No wallet was charged.",
  "request-id": "Test_1",
  "sandbox": true,
  "system": "SANDBOX"
}
```

<Note>
  Purchases are simulated. **Read-only** endpoints — [Check Balance](/reference/balance), [validation](/reference/verify-smartcard), and the [catalogs](/guides/catalogs) — return your **real data** on the sandbox URL too, so you can validate against real plan IDs and customer lookups.
</Note>

<Tip>
  In the API playground, pick **Sandbox** from the server dropdown to send test calls without leaving the docs.
</Tip>

## Simulate a failure

Add `"sandbox_status": "fail"` to any request to test your error handling:

```json theme={null}
{
  "network": 1,
  "phone": "2347013397088",
  "data_plan": 19,
  "request-id": "Test_2",
  "sandbox_status": "fail"
}
```

```json Response theme={null}
{
  "status": "fail",
  "message": "[SANDBOX] Simulated failed transaction. No wallet was charged.",
  "request-id": "Test_2",
  "sandbox": true
}
```

## Going live

When you're ready, switch the base URL to `https://api.mysubwallet.ng` (and use your live key) — same endpoints, same payloads. Confirm `sandbox` is no longer in the response and your wallet balance changes as expected.

<Warning>
  Keep your keys server-side. Never ship them in client-side code.
</Warning>
