Build with Nasfam Business
One request places an order. Follow it to its result, and see every request you sent in your dashboard.
# One key per purchase: make it once, keep it with the purchase, and send the same key on every retry.: "${IDEMPOTENCY_ KEY:?Set IDEMPOTENCY_ KEY once for this purchase ( a new UUID) and keep it for every retry}"curl -X POST "https:// sandbox-api. nasfampay. com/ v1/ orders" \ -H "Authorization: Bearer $NASFAM_ SANDBOX_ KEY" \ -H "Content-Type: application/ json" \ -H "Idempotency-Key: $IDEMPOTENCY_ KEY" \ -d '{ "quote_ id": "quo_ 01K7SAMP000000000000000090", "reference": "TEST-0001" }'{ "id": "ord_ 01K7SAMP000000000000000090", "status": "processing", "amount": { "amount": 75, "currency": "USD" }}order.succeededSucceededSigned under Standard Webhooks v1, sent to your endpoint when the order ends.What you can check before you build
- A sandbox where a test username chooses the outcome, failures included
- Send yourself a signed test event, then replay any delivery
- Webhooks retried for about 3 days
- Check the recipient before you pay; a quote holds its price for 60 seconds
- An unconfirmed delivery is held and reviewed, never refunded on a timer
- We never ask for your Telegram or Fragment login, or a wallet seed
From key to first order
Four steps on test money, with nothing to install. Each opens its page in the docs, with the code and what you should see.
Create a test key
Sign up, name your workspace and create a key. It works only with test money, and its secret is shown to you once.
Add test funds
Put test money on your balance. Nothing real moves in the sandbox.
Look up the recipient
Find the Telegram account at a username, and let your customer confirm it.
Place one order
Order Stars or Premium, and receive a signed event when the order ends.
Then, for Live: ask for activation in your dashboard, create a live key and send the same request to the Live host.
Two environments, one integration
A key works only on its own host. Nothing crosses between the two.
| Sandbox | Live | |
|---|---|---|
| Opens | Needs only an account | Once your business is activated |
| Host | https://sandbox-api.nasfampay.com/v1 | https://api.nasfampay.com/v1 |
| Key prefix | nbk_test_ | nbk_live_ |
| Money | Test money only. No order reaches Telegram or a blockchain. | Real money from your balance. A Live key needs a business activated for Live. |
Order from a quote
Quote the recipient first, then create the order from that quote, in the language and client you use. Every example is generated from the API contract.
- Authorization
- Your key, read from the environment. Never commit it or send it to a browser.
- Idempotency-Key
- One per order, reused on every retry. The same key returns the first order, never a second.
- quote_id
- The quote you created first. It holds its price for up to 60 seconds, and the order costs exactly that.
- 202 Accepted
- The order finishes after the response. Read its final state, or receive the event.
// npm install axiosimport axios from 'axios';// One key per purchase: make it once, keep it with the purchase, and send the same key on every retry.const idempotencyKey = process. env. IDEMPOTENCY_ KEY;if ( !idempotencyKey) throw new Error( 'Set IDEMPOTENCY_ KEY once for this purchase ( a new UUID) and keep it for every retry');try { const { status, data: order } = await axios. post( 'https:// sandbox-api. nasfampay. com/ v1/ orders', { quote_ id: 'quo_ 01K7SAMP000000000000000001', reference: 'INV-1001', }, { headers: { Authorization: `Bearer ${process. env. NASFAM_ SANDBOX_ KEY}`, 'Idempotency-Key': idempotencyKey, }, }, ); console. log( status, order);} catch ( error) { if ( !axios. isAxiosError( error) || !error. response) throw error; const problem = error. response. data; throw new Error( `${problem. status} ${problem. code}: ${problem. title} ( request ${problem. request_ id})`);}Examples in Node.js, TypeScript, Python, PHP, cURL.
Every request follows four rules
Learn them once, and every operation behaves the way you expect.
Authentication
One bearer key per environment, sent on every request.
Read authenticationIdempotency
Retry any request, including one that changes your balance, without ever paying twice.
Read idempotencyErrors
Every error is a problem document with a stable code, its usual cause and how to recover.
Read errorsRate limits
What the API does when you send too much, and how to back off.
Read rate limits
Questions developers ask
Anything else is in the docs, or ask us through the contact page.
Is there a sandbox?
Which languages have examples?
Is there an OpenAPI document?
Are webhooks signed?
Is Nasfam Business affiliated with Telegram?
In the docs
Every page also answers as Markdown, for you or for the assistant you work with.
- API reference
Every operation, its fields and its errors.
- Webhooks
Signed events for every change of status.
- Test scenarios
What you can make a test order do, and where the money is.
- Failure recovery
When an answer never arrives: what to do, and where your money is.
- Changelog
What changed in the API, by version.
- For AI assistants
Every page of the docs, listed for an assistant to read.
Make your Sandbox key and send a first request.
Keys are made in your dashboard and the secret is shown once. Sandbox runs on test money.
