← Developer Guides

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
curl -X GET https://{your-domain}/api/v1/airtime/networks \
  -H "Authorization: Bearer sk_live_your_secret_key"
JavaScript
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#

JSON
{
  "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
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
  }'
JavaScript
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();
Python
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())
PHP
$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#

ParameterTypeRequiredDescription
phone_numberstringYesRecipient phone number in international format (must start with 234)
amountintegerYesAmount 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_keystringNoUnique 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:

JSON
{
  "id": "01kw463z1czwnst3yknbkzczn2",
  "title": null,
  "amount": 50000,
  "fee": 0,
  "amount_paid": 50000,
  "currency_code": "NGN",
  "status": "success",
  "is_test": false,
  "created_at": 1751270400
}
FieldTypeDescription
idstringThe purchase ULID — its reference. Use it with GET /api/v1/purchases/{id} to look the purchase up.
titlestring | nullA display label, when one is recorded. Often null; do not rely on it.
amountintegerThe airtime value, in the smallest currency unit.
feeintegerThe fixed fee within amount_paid (0 if none).
amount_paidintegerWhat your wallet was debited, in the smallest currency unit.
currency_codestringISO 4217 currency of the amounts.
statusstringsuccess, or processing while the network confirms it — subscribe to the purchase.success / purchase.failed webhooks, or poll GET /api/v1/purchases/{id}.
is_testbooleantrue for a purchase made with your test key.
created_atintegerUnix timestamp (seconds).

Note: Request and response amounts are both in the smallest currency unit (kobo for NGN, so 50000 = ₦500.00). Read the currency_code and 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
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#

CodeError CodeDescription
402INSUFFICIENT_BALANCEWallet balance too low
404NETWORK_NOT_FOUNDNetwork slug not recognized
422Validation errorInvalid phone number or amount
429DAILY_LIMIT_REACHEDDaily transaction limit exceeded
429LIMIT_EXCEEDEDThe 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
409LIMIT_CHECK_BUSYAnother 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
400PROVIDER_REJECTEDThe network provider rejected the request
500ERRORInternal server error

Error Response Format#

JSON
{
  "success": false,
  "message": "Insufficient wallet balance",
  "code": "INSUFFICIENT_BALANCE"
}