Skip to content

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

EnvironmentHost and key
Sandboxsandboxhttps://sandbox-api.nasfampay.com/v1, with a nbk_test_ key in NASFAM_SANDBOX_KEY. Test money only: nothing reaches Telegram or a blockchain.
Livelivehttps://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 are not_found.
  • Test recipients. A telegram_username in the nasfam_test_ namespace chooses a simulated outcome in the sandbox. Live refuses every one with recipient_not_eligible. See Sandbox scenarios.
  • Recipient lookups. Live always asks the Telegram provider (lookup_source is provider). 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_ or nbk_live_.
  • GET /account answers with the environment the 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:

Code for What you should see
Sandbox: the account behind a test key
JSON
200 OKSynthetic sandbox data
{  "id": "org_01K7SAMP000000000000000090",  "name": "Example Business Ltd",  "environment": "sandbox",  "kyb_status": "sandbox_only",  "limits": {    "max_queued": 50  }}

If it fails

What you seeWhat to check
key_environment_mismatchThe key and the host belong to different environments. Read the host from the same configuration as the key.
not_found on a /sandbox routeThe request went to the Live host. Those routes exist on the Sandbox host only.
recipient_not_eligibleA nasfam_test_ username reached Live. Use your customer's username there.