Sandbox and Live
Two hosts, two kinds of key and two balances. What is the same, what differs, and how to tell where a request went.
Sandbox: test money only. No request moves real money.
This page explains the two environments, so you always know which one a request went to.
Build against the sandbox, then switch the host and the key. The operations, fields, statuses and errors are the same on both, so code that works in the sandbox needs no other change for Live.
Hosts and keys
| Environment | Host and key |
|---|---|
| Sandboxsandbox | https:/, with a nbk_test_ key in NASFAM_SANDBOX_KEY. Test money only: nothing reaches Telegram or a blockchain. |
| Livelive | https://api.nasfampay.com/v1, with a nbk_live_ key in NASFAM_LIVE_KEY. Real money: an order spends your real balance and is delivered. |
A key works on its own host only. Sent to the other one, it is refused with key_environment_mismatch before anything is read. Keep the two keys in separate configuration, and read the host from the same place as the key.
What differs
- Sandbox-only operations.
POST /,sandbox/ funding/ deposits POST /sandbox/deposits,GET /sandbox/test-runs,POST /sandbox/test-runs,GET /sandbox/test-runs/{id}exist on the sandbox host alone. On Live they arenot_found. - Test recipients. A
telegram_usernamein thenasfam_test_namespace chooses a simulated outcome in the sandbox. Live refuses every one withrecipient_not_eligible. See Sandbox scenarios. - Recipient lookups. Live always asks the Telegram provider (
lookup_sourceisprovider). The sandbox answers with a sample account (simulated), unless Nasfam has real lookups on there. - Money. The sandbox balance holds synthetic money you add yourself. A Live balance is funded for real: see Funding your account.
- Getting a key. A sandbox key needs only an account. A Live key exists once your business is activated for Live: see Complete Live activation.
How to tell where a request went
- The key's prefix:
nbk_test_ornbk_live_. GET /accountanswers with theenvironmentthe key belongs to.- Every order and every event carries the same
environment. Check it before you deliver anything to a customer.
What you should see
GET /account names the environment a key belongs to. With a Sandbox key it answers sandbox:
{ "id": "org_ 01K7SAMP000000000000000090", "name": "Example Business Ltd", "environment": "sandbox", "kyb_ status": "sandbox_ only", "limits": { "max_ queued": 50 }}If it fails
| What you see | What to check |
|---|---|
key_environment_mismatch | The key and the host belong to different environments. Read the host from the same configuration as the key. |
not_found on a /sandbox route | The request went to the Live host. Those routes exist on the Sandbox host only. |
recipient_not_eligible | A nasfam_test_ username reached Live. Use your customer's username there. |
Related guides
- Authentication and keys: the key format, and every way a key is refused.
- Create an API key: your first Sandbox key.
- Complete Live activation: what Live needs before the first real order.
