Airtime API#
Purchase airtime (mobile credit) for any supported network. Airtime is deducted from your wallet balance.
List Available Networks#
GET /api/v1/airtime/networks
Returns all networks available for airtime purchase:
curl -X GET https://{your-domain}/api/v1/airtime/networks \
-H "Authorization: Bearer sk_live_your_secret_key"const response = await fetch(
"https://{your-domain}/api/v1/airtime/networks",
{
headers: { Authorization: "Bearer sk_live_your_secret_key" },
}
);
const data = await response.json();Response#
{
"networks": [
{ "slug": "mtn", "name": "MTN" },
{ "slug": "glo", "name": "Glo" },
{ "slug": "airtel", "name": "Airtel" },
{ "slug": "9mobile", "name": "9mobile" }
]
}Purchase Airtime#
POST /api/v1/airtime/networks/{network}/purchase
The {network} path parameter is the network slug (e.g., mtn, glo, airtel, 9mobile). The amount is in the smallest currency unit — kobo for NGN — so ₦500 of airtime is 50000.
curl -X POST https://{your-domain}/api/v1/airtime/networks/mtn/purchase \
-H "Authorization: Bearer sk_live_your_secret_key" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Idempotency-Key: order-7f3a9c" \
-d '{
"phone_number": "2348012345678",
"amount": 50000
}'const response = await fetch(
"https://{your-domain}/api/v1/airtime/networks/mtn/purchase",
{
method: "POST",
headers: {
Authorization: "Bearer sk_live_your_secret_key",
"Content-Type": "application/json",
Accept: "application/json",
"Idempotency-Key": "order-7f3a9c",
},
body: JSON.stringify({
phone_number: "2348012345678",
amount: 50000, // ₦500, in kobo
}),
}
);
const result = await response.json();import requests
response = requests.post(
"https://{your-domain}/api/v1/airtime/networks/mtn/purchase",
headers={
"Authorization": "Bearer sk_live_your_secret_key",
"Accept": "application/json",
"Idempotency-Key": "order-7f3a9c",
},
json={
"phone_number": "2348012345678",
"amount": 50000, # ₦500, in kobo
},
)
print(response.json())$response = Http::withToken('sk_live_your_secret_key')
->acceptJson()
->withHeaders(['Idempotency-Key' => 'order-7f3a9c'])
->post('https://{your-domain}/api/v1/airtime/networks/mtn/purchase', [
'phone_number' => '2348012345678',
'amount' => 50000, // ₦500, in kobo
]);Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
phone_number | string | Yes | Recipient phone number in international format (must start with 234) |
amount | integer | Yes | Amount in the currency's smallest unit (kobo for NGN: 50000 is ₦500), like every other amount in the API. The minimum is 10 major units of the tenant's currency — 1000 for NGN; read the exact figure from currency.minimum_purchase_minor on GET /tenant. See Amounts & Currency. |
idempotency_key | string | No | Unique key (max 64 chars) to prevent duplicate purchases. You can send it as the Idempotency-Key header instead; see Idempotency. |
Response#
200, whether this request made the purchase or replayed it:
{
"id": "01kw463z1czwnst3yknbkzczn2",
"title": null,
"amount": 50000,
"fee": 0,
"amount_paid": 50000,
"currency_code": "NGN",
"status": "success",
"is_test": false,
"created_at": 1751270400
}| Field | Type | Description |
|---|---|---|
id | string | The purchase ULID — its reference. Use it with GET /api/v1/purchases/{id} to look the purchase up. |
title | string | null | A display label, when one is recorded. Often null; do not rely on it. |
amount | integer | The airtime value, in the smallest currency unit. |
fee | integer | The fixed fee within amount_paid (0 if none). |
amount_paid | integer | What your wallet was debited, in the smallest currency unit. |
currency_code | string | ISO 4217 currency of the amounts. |
status | string | success, or processing while the network confirms it — subscribe to the purchase.success / purchase.failed webhooks, or poll GET /api/v1/purchases/{id}. |
is_test | boolean | true for a purchase made with your test key. |
created_at | integer | Unix timestamp (seconds). |
Note: Request and response amounts are both in the smallest currency unit (kobo for NGN, so
50000= ₦500.00). Read thecurrency_codeand use that currency's minor unit rather than assuming a factor of 100.
Idempotency#
To prevent duplicate airtime purchases (e.g., on network retries), send an idempotency key — as the Idempotency-Key header (above) or as idempotency_key in the request body:
curl -X POST https://{your-domain}/api/v1/airtime/networks/mtn/purchase \
-H "Authorization: Bearer sk_live_your_secret_key" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"phone_number": "2348012345678",
"amount": 50000,
"idempotency_key": "unique-request-id-123"
}'If a request with the same idempotency key has already been processed, the API returns the original purchase without creating a duplicate transaction. If you send both the header and the body field, they must be the same key; two different keys are refused with 422 and nothing is charged. See Idempotency.
Error Codes#
| Code | Error Code | Description |
|---|---|---|
402 | INSUFFICIENT_BALANCE | Wallet balance too low |
404 | NETWORK_NOT_FOUND | Network slug not recognized |
422 | Validation error | Invalid phone number or amount |
429 | DAILY_LIMIT_REACHED | Daily transaction limit exceeded |
429 | LIMIT_EXCEEDED | The amount is below a minimum, above a per-transaction limit, or above what is left of a daily or monthly limit. Nothing was charged. The limit object says which bound (source, bound, limit_minor, currency_code, and for daily/monthly the remaining_minor and resets_at); see the API reference. Earlier releases answered this with HTTP 500 |
409 | LIMIT_CHECK_BUSY | Another purchase on your account was being checked against its daily or monthly limit. Nothing was charged; retry the same request, with the same idempotency key |
400 | PROVIDER_REJECTED | The network provider rejected the request |
500 | ERROR | Internal server error |
Error Response Format#
{
"success": false,
"message": "Insufficient wallet balance",
"code": "INSUFFICIENT_BALANCE"
}