01Getting started
4 steps
- Open a store. In the tolovgo.uz dashboard, choose “Create store”. The store becomes active once an admin approves it.
- Get an API key. On the store page, open “API key”. You can restrict the key to specific IPs.
- Create a payment.
POST /create→ give the customer thepay_urlfrom the response. - Handle the callback. When
status=paidarrives, fulfil the order.
Every request must include the X-Api-Key header. If the key is IP-restricted, requests from other IPs are rejected.
02Endpoints
relative to https://pay.tolovgo.uz/api
| Method | Path | Purpose |
|---|---|---|
| POST | /create | Create a payment. Callback is a GET, sent only once paid. |
| GET | /status/{order_id} | Payment status. Pass an order_id or order_hash. |
| POST | /v1/orders | Create a payment, v1. Callback is a JSON POST: order.paid, order.expired, order.cancelled, order.refunded. |
| GET | /v1/orders/{id} | Payment status, v1. |
03POST /create
Fields, request and response
| Field | Type | Description |
|---|---|---|
| amount | integer | Required. In UZS, 1,000 — 99,999,999. |
| note | string | Note, up to 500 characters. Returned in the callback. |
| callback_url | url | Called once the payment is made. Must be a public internet address. If omitted, the store's default URL is used. |
| return_url | url | Page the customer returns to after paying. |
Extra v1 fields: external_id (64), description (500), payer.telegram_id, payer.username, payer.name.
Request
curl -X POST https://pay.tolovgo.uz/api/create \
-H "X-Api-Key: SIZNING_KALIT" \
-d amount=25000 \
-d note="Order #1042" \
-d callback_url=https://sayt.uz/tolovgo-callback
Response · 201
{
"ok": true,
"status": "pending",
"order_id": 1042,
"amount": 25000,
"pay_url": "https://pay.tolovgo.uz/pay/…",
"providers": { /* click, payme, paynet, xazna — direct links */ }
}
04Statuses
Payment lifecycle
pending · paid · expired · cancelled · refunded
An unpaid link becomes expired after 1 hour. Even after a callback, it's best to confirm the status with GET /status/{order_id} before fulfilling the order.
05Errors
HTTP codes
| HTTP | Code | Reason |
|---|---|---|
| 401 | missing_credentials | X-Api-Key header missing |
| 401 | invalid_credentials | Invalid key |
| 401 | key_revoked | Key revoked |
| 401 | ip_not_allowed | This IP address isn't allowed |
| 403 | merchant_inactive | Store is not active |
| 422 | — | Invalid field: {"ok": false, "error": "…"} |
| 429 | — | Exceeded 120 requests per minute |
06Money
Where it goes
- Payment — credited to the store balance minus the service fee (Click, Payme, Paynet — 6%, Xazna — 6%).
- Payout — to a card via the dashboard. Terms: Terms of use, section 5.
- Refunds — v1 stores receive the
order.refundedevent.
07Test mode
Integrate without real money
- Get a test key. In the store settings, “Test key” — it starts with
test_. It works on the same endpoints as the live key. - Create a payment. The response contains
"test": true, andprovidersis empty. - Pick the outcome. The
pay_urlpage shows “Mark as paid” and “Cancel” buttons. - Check your callback. It arrives exactly like a real payment — same fields.
Test payments move no money and never reach the balance, statistics or notifications. A test key only sees test orders; a live key only sees real ones.
08Code samples
Create a payment
<?php
// Create a payment
$ch = curl_init('https://pay.tolovgo.uz/api/create');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-Api-Key: ' . getenv('TOLOVGO_KEY')],
CURLOPT_POSTFIELDS => [
'amount' => 25000,
'note' => 'Buyurtma #1042',
'callback_url' => 'https://sayt.uz/tolovgo-callback',
],
]);
$order = json_decode(curl_exec($ch), true);
header('Location: ' . $order['pay_url']);import os
import requests
# Create a payment
r = requests.post(
"https://pay.tolovgo.uz/api/create",
headers={"X-Api-Key": os.environ["TOLOVGO_KEY"]},
data={"amount": 25000, "note": "Buyurtma #1042",
"callback_url": "https://sayt.uz/tolovgo-callback"},
timeout=15,
)
order = r.json()
print(order["pay_url"])// Create a payment (Node 18+)
const res = await fetch("https://pay.tolovgo.uz/api/create", {
method: "POST",
headers: { "X-Api-Key": process.env.TOLOVGO_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ amount: 25000, note: "Buyurtma #1042",
callback_url: "https://sayt.uz/tolovgo-callback" }),
});
const order = await res.json();
console.log(order.pay_url);