Build with Billam
One API platform for Nigerian digital services and Android-powered automation. Integrate Airtime, Data, Pay TV, Electricity, Recharge PIN, SMS and USSD with predictable authentication and wallet billing.
Quick start
Your first authenticated request takes three steps.
Replace the token with a key that has plans:read.
curl https://billam.com.ng/api/reseller-airtime-networks.php -H "Authorization: Bearer $TELECLASP_API_KEY"One pattern across every reseller service
Airtime, Data, Pay TV, Electricity and Recharge PIN follow the same integration lifecycle.
Account, Wallet & Orders
These endpoints are shared across the Reseller API. Use them to verify your integration, check funds and follow transactions without building a different status flow for every service.
1. Verify your API key
/reseller-me.phpplans:readcurl https://billam.com.ng/api/reseller-me.php -H "Authorization: Bearer $TELECLASP_API_KEY"{
"success": true,
"developer": {
"id": 12
},
"api_key": {
"id": 34,
"rate_limit_per_min": 60
},
"environment": "live",
"message": "API key is valid"
}2. Check your wallet
/reseller-wallet.phpplans:readcurl https://billam.com.ng/api/reseller-wallet.php -H "Authorization: Bearer $TELECLASP_API_KEY"{
"success": true,
"wallet": {
"currency": "NGN",
"available": "12500.00",
"available_kobo": 1250000,
"held": "0.00",
"held_kobo": 0,
"status": "active"
}
}available_kobo for integer money arithmetic. held represents funds reserved by transactions that have not reached a final outcome.3. Check any reseller order
/reseller-order-status.php?order_uid=...purchase:writeOne status endpoint works across all reseller transaction services.
curl "https://billam.com.ng/api/reseller-order-status.php?order_uid=RSA_..." -H "Authorization: Bearer $TELECLASP_API_KEY"The top-level shape is consistent. Fields inside order vary only where the service needs additional information such as a meter, decoder, network or recharge denomination.
{
"success": true,
"service": "airtime",
"order": {
"order_uid": "RSA_...",
"status": "completed",
"amount": "975.00",
"reference": "...",
"created_at": "2026-09-20 10:20:00",
"completed_at": "2026-09-20 10:20:04"
}
}order_uid. If a purchase is pending or your HTTP connection drops, check that order before attempting another purchase.HTTP, Errors & Transaction States
All API responses are JSON. Check both the HTTP status code and the response body before deciding whether to retry.
| HTTP | Meaning | Recommended action |
|---|---|---|
| 200 / 201 | Success | Process and persist the returned identifiers |
| 202 | Outcome pending | Save order_uid/job_uid and check status |
| 400 | Malformed request | Fix the request body or JSON |
| 401 | Authentication failed | Check the Bearer token |
| 402 | Insufficient balance | Fund the developer wallet |
| 403 | Invalid scope | Use a key with the required scope |
| 404 | Not found | Check the resource or order identifier |
| 409 | Conflict | Inspect the existing transaction before retrying |
| 422 | Validation error | Correct the supplied fields |
| 429 | Rate limited | Back off before retrying |
| 500 | Internal error | Retry cautiously using the same idempotency key |
| 502 | Provider failure | Inspect error/refund status before retrying |
| 503 | Temporarily unavailable | Back off and retry safely |
Standard error
{
"success": false,
"error": "invalid_scope"
}Common reseller transaction fields
| Field | Meaning |
|---|---|
| order_uid | Billam identifier for the reseller transaction |
| status | Current order state |
| amount | Amount debited from your developer wallet |
| face_value | Full delivered value when different from wallet charge |
| discount_percent | Applied discount where supported |
| discount_amount | Naira amount saved |
| reference | Provider or fulfillment reference where available |
| failure_code | Machine-readable reason for a failed/unresolved order |
Reseller states
202 or lost the HTTP response. Query the original order_uidfirst.Gateway API — SMS & USSD
Send text messages and dial USSD codes through an Android phone paired to your account.
order_uid. Gateway automation returns a job_uid because execution happens asynchronously on your paired Android device./devices.php before sending anything time-sensitive.Base URL: https://billam.com.ng/payplug/api/v1/gateway
1. Pair a device
Install the Billam Gateway app on the Android phone you want sending messages, then log in and pair it to your account. You'll confirm it's online in step 3.
2. Create an API key
From your developer dashboard, open the Gateway API tab and generate a key with the scopes you need:
| Scope | Grants |
|---|---|
| gateway:read | View devices, job status, and webhook history |
| sms:send | Create SEND_SMS automation jobs |
| ussd:execute | Create EXECUTE_USSD automation jobs |
The key is shown once, as tc_live_... — copy it immediately. Store it as an environment variable on your server. Never put it in frontend JavaScript, a mobile app bundle, or a public repo.
tc_live_...). A tc_test_... key returns automation_requires_live_key.3. Confirm you're ready
Two checks before sending anything live.
Is the key working?
curl https://billam.com.ng/payplug/api/v1/gateway/me.php -H "Authorization: Bearer $TELECLASP_API_KEY"Is your device online?
curl https://billam.com.ng/payplug/api/v1/gateway/devices.php -H "Authorization: Bearer $TELECLASP_API_KEY"Look for "online": true and copy the device_uid — every message you send needs it. A device not seen in the last 60 seconds is treated as offline and the request is rejected with gateway_offline before anything is billed.
4. Pricing — pay-as-you-go
Every automation job is billed individually at time of send. There are no plans or subscriptions — you're charged only for what you actually use, held from your wallet the moment the job is created and captured once it completes.
| Service class | Job types | Rate |
|---|---|---|
| DATA | SEND_SMS | ₦5.00 per message |
| AIRTIME | EXECUTE_USSD | ₦0.50 per USSD dial |
AIRTIME jobs must use EXECUTE_USSD — airtime_requires_ussd is returned otherwise. DATA jobs may use either SEND_SMS or EXECUTE_USSD, depending on what your paired SIM supports.
5. Send an SMS
curl -X POST https://billam.com.ng/payplug/api/v1/gateway/automation/create.php -H "Authorization: Bearer $TELECLASP_API_KEY" -H "Idempotency-Key: order-1042-confirmation" -H "Content-Type: application/json" -d '{
"device_uid": "dev_...",
"service_class": "DATA",
"type": "SEND_SMS",
"payload": {
"to": "08012345678",
"body": "Your order has shipped!",
"sim_slot": 1
}
}'Idempotency-Key is a unique string per message — an order ID works well. Retrying the same request with the same key returns the original job instead of creating and billing a new one.
Successful response (201):
{
"success": true,
"duplicate": false,
"request_uid": "AUT-...",
"job_uid": "JOB-...",
"job_id": 39,
"service_class": "DATA",
"type": "SEND_SMS",
"billing": {
"mode": "payg",
"rate_kobo": 500,
"amount_kobo": 500,
"status": "reserved"
}
}201 here means the job was accepted and billed as a hold, not delivered. See step 7 to confirm what actually happened — the hold is only captured once the job completes.6. Dial a USSD code
Same endpoint, different service_class/type/payload:
curl -X POST https://billam.com.ng/payplug/api/v1/gateway/automation/create.php -H "Authorization: Bearer $TELECLASP_API_KEY" -H "Idempotency-Key: balance-check-0042" -H "Content-Type: application/json" -d '{
"device_uid": "dev_...",
"service_class": "AIRTIME",
"type": "EXECUTE_USSD",
"payload": {
"code": "*323*4#",
"sim_slot": 1
}
}'The network's USSD reply (e.g. an airtime balance) appears in the job result once it completes.
7. Find out what actually happened
Option A — Poll for status (simplest to start with):
curl "https://billam.com.ng/payplug/api/v1/gateway/jobs/status.php?job_uid=JOB-..." -H "Authorization: Bearer $TELECLASP_API_KEY"Check every few seconds until status becomes success or failed.
Option B — Register a webhook (better for production): Billam calls a URL on your server the moment a job finishes (gateway.job.succeeded, gateway.job.failed), so you don't need to poll at all. Always verify the signature before trusting the payload:
$signature = hash_hmac('sha256', $timestamp . '.' . file_get_contents('php://input'), $yourWebhookSecret);
if (!hash_equals($signature, $providedSignature)) {
http_response_code(401);
exit;
}Job & billing status values
| Status | Meaning |
|---|---|
| pending | Waiting for the Android Gateway to pick it up |
| sent | Fetched by the device, awaiting a definitive result |
| success | Completed successfully — wallet hold captured |
| failed | Gateway reported a definitive failure — wallet hold released |
| expired | Timed out without completing — wallet hold released |
Common mistakes
- Treating
201as delivered. It only means the job was accepted and billed as a hold — confirm via status check or webhook before assuming it sent. - Not checking
onlinefirst. A device not seen in the last 60 seconds is rejected withgateway_offlinebefore any wallet hold is placed. - Reusing an idempotency key for a different message. Each key should map to exactly one send.
- Assuming SIM 2 exists. Single-SIM devices will reject
sim_slot: 2— check the device'ssiminfo if unsure. - Sending AIRTIME as SEND_SMS.
AIRTIMEonly supportsEXECUTE_USSD— useDATAfor SMS.
Error codes
| Code | Status | Meaning |
|---|---|---|
| authentication_required | 401 | No/malformed Authorization header |
| invalid_api_key | 401 | Key doesn't exist, wrong prefix, or was revoked |
| api_key_revoked | 401 | Key was explicitly revoked |
| api_key_expired | 401 | Key has expired |
| automation_requires_live_key | 409 | A tc_test_... key was used — automation billing needs tc_live_... |
| insufficient_scope | 403 | Key lacks the scope this endpoint requires |
| invalid_idempotency_key | 400 | Missing, too short/long, or invalid characters |
| invalid_device_uid | 400 | Missing or malformed device_uid |
| invalid_service_class | 400 | service_class must be AIRTIME or DATA |
| invalid_job_type | 400 | type must be SEND_SMS or EXECUTE_USSD |
| airtime_requires_ussd | 400 | AIRTIME jobs must use EXECUTE_USSD |
| invalid_sim_slot | 400 | sim_slot must be 1 or 2 |
| invalid_sms_payload | 400 | SEND_SMS payload missing/invalid to or body |
| invalid_ussd_payload | 400 | EXECUTE_USSD payload missing/invalid code |
| automation_target_not_found | 404 | device_uid/sim_slot doesn't match a paired, owned device |
| gateway_offline | 409 | Device not seen in the last 60 seconds |
| sim_verification_required | 409 | SIM hasn't completed slot verification |
| sim_not_ready | 409 | SIM is inactive or not ready |
| airtime_automation_disabled | 409 | AIRTIME automation not enabled for this line |
| data_automation_disabled | 409 | DATA automation not enabled, or SIM lacks the needed capability |
| automation_idempotency_conflict | 409 | Idempotency key reused with different request details |
| insufficient_wallet_balance | 402 | Account & Wallet too low to reserve this job's rate |
| rate_limit_exceeded | 429 | Too many requests for this key |
Quick reference
| Action | Endpoint | Scope needed |
|---|---|---|
| Confirm your key works | GET /me.php | gateway:read |
| Check device status | GET /devices.php | gateway:read |
| Send an SMS | POST /automation/create.php (service_class: DATA, type: SEND_SMS) | sms:send |
| Dial USSD | POST /automation/create.php (service_class: AIRTIME, type: EXECUTE_USSD) | ussd:execute |
| Check a job's outcome | GET /jobs/status.php | gateway:read |
| See missed webhook deliveries | GET /webhooks/events.php | gateway:read |
Reseller API — Airtime
Send airtime programmatically using your Billam developer wallet. Current network discounts are applied automatically.
Base URL: https://billam.com.ng/api/
| Endpoint | Scope |
|---|---|
| GET /reseller-airtime-networks.php | plans:read |
| POST /reseller-airtime-purchase.php | purchase:write |
List networks and rates
curl https://billam.com.ng/api/reseller-airtime-networks.php -H "Authorization: Bearer $TELECLASP_API_KEY"{
"success": true,
"networks": [
{
"network": "MTN",
"name": "MTN",
"min_amount": "50.00",
"max_amount": "50000.00",
"discount_percent": "2.50"
}
]
}Purchase airtime
curl -X POST https://billam.com.ng/api/reseller-airtime-purchase.php -H "Authorization: Bearer $TELECLASP_API_KEY" -H "Content-Type: application/json" -d '{
"network": "MTN",
"phone": "08031234567",
"amount": 1000,
"idempotency_key": "airtime-order-1042"
}'amount in the request is the full airtime value delivered. Your wallet is charged the discounted amount.
{
"success": true,
"order_uid": "RSA_...",
"network": "MTN",
"phone": "08031234567",
"face_value": "1000.00",
"amount": "975.00",
"discount_percent": "2.50",
"discount_amount": "25.00",
"status": "completed"
}idempotency_key for each intended purchase. Retrying the same request with the same key is safe.Reseller API — Pay TV
List subscription packages, validate decoder/account numbers and purchase Pay TV subscriptions using your developer wallet.
Providers: DStv, GOtv, StarTimes, IrokoTV, AATV Radio and ACTV.
| Endpoint | Scope |
|---|---|
| GET /reseller-cable-plans.php | plans:read |
| POST /reseller-cable-validate.php | purchase:write |
| POST /reseller-cable-purchase.php | purchase:write |
List providers
curl https://billam.com.ng/api/reseller-cable-plans.php -H "Authorization: Bearer $TELECLASP_API_KEY"Get provider packages
curl "https://billam.com.ng/api/reseller-cable-plans.php?provider=DSTV" -H "Authorization: Bearer $TELECLASP_API_KEY"Use the returned service_code when purchasing. The package response includes the regular price, your discount and your effective reseller price.
Validate decoder
curl -X POST https://billam.com.ng/api/reseller-cable-validate.php -H "Authorization: Bearer $TELECLASP_API_KEY" -H "Content-Type: application/json" -d '{
"provider": "DSTV",
"decoder": "1234567890"
}'can_verify: false. Confirm the customer's account number yourself before purchasing for providers without online verification.Purchase subscription
curl -X POST https://billam.com.ng/api/reseller-cable-purchase.php -H "Authorization: Bearer $TELECLASP_API_KEY" -H "Content-Type: application/json" -d '{
"provider": "DSTV",
"decoder": "1234567890",
"service_code": "<service-code-from-plans>",
"phone": "08031234567",
"idempotency_key": "paytv-order-1042"
}'{
"success": true,
"order_uid": "RST_...",
"provider": "DSTV",
"provider_name": "DStv",
"decoder": "1234567890",
"package_name": "...",
"face_value": "5000.00",
"amount": "4900.00",
"discount_percent": "2.00",
"discount_amount": "100.00",
"status": "completed"
}The full package value is sent to the provider while your developer wallet is debited at the current discounted rate.
Reseller API — Data
Buy mobile data programmatically at your own reseller wallet rate — no PIN, no customer session.
Base URL: https://billam.com.ng/api/
Get started by activating developer access and generating a key from your developer dashboard.
Authentication
Every request needs a Bearer token in the Authorization header:
Authorization: Bearer <public_key>.<secret>You get this token once, when you generate a key from your dashboard. It is shown only once — copy it immediately. If lost, revoke the key and generate a new one.
Each key has scopes (plans:read, purchase:write) and its own rate limit. Calling an endpoint your key isn't scoped for returns invalid_scope.
GET /reseller-plans.php
Returns available data plans at your reseller rate.
Query parameters (optional): network — one of MTN, AIRTEL, GLO, 9MOBILE. Omit to get all networks.
curl https://billam.com.ng/api/reseller-plans.php?network=MTN \
-H "Authorization: Bearer <token>"Response:
{
"success": true,
"plans": [
{
"plan_id": 13,
"network": "MTN",
"plan_type": "GIFTING",
"name": "MTN CG 200MB Monthly",
"size": "200MB",
"validity": "Monthly",
"price": "80.00"
}
]
}price is your wallet rate in naira (already discounted from the customer-facing price) — this is what gets debited on purchase.
POST /reseller-purchase.php
Buys a data plan for a phone number, debiting your wallet.
Request body:
{
"plan_id": 13,
"phone": "08031234567",
"idempotency_key": "your-unique-key-per-attempt"
}plan_id— from/reseller-plans.phpphone— 11-digit local (0803...) or 13-digit international (234803...) formatidempotency_key— required. Reusing the same key for the same request returns the original result instead of charging again — safe to retry on network errors without double-purchasing.
Success response (200):
{
"success": true,
"order_uid": "RSL_20260904_ABCD123456",
"network": "MTN",
"phone": "08031234567",
"plan_name": "MTN CG 200MB Monthly",
"data_size": "200MB",
"amount": "80.00",
"reference": "RSL_20260904_ABCD123456",
"status": "completed",
"timestamp": "2026-09-04T21:30:00+01:00"
}Failure — insufficient balance (402):
{ "success": false, "error": "insufficient_balance" }Failure — all providers unavailable (502). No charge occurs — the hold is released automatically:
{ "success": false, "error": "all_providers_unavailable", "refunded": true }Idempotent replay (same idempotency_key reused):
{ "success": true, "order_uid": "RSL_...", "status": "completed", "note": "idempotent_replay" }Error codes
| Code | Status | Meaning |
|---|---|---|
| authentication_required | 401 | No/malformed Authorization header |
| invalid_token | 401 | Key doesn't exist or secret is wrong |
| key_revoked | 401 | Key was revoked |
| invalid_scope | 403 | Key lacks the required scope |
| rate_limit_exceeded | 429 | Too many requests for this key |
| invalid_plan / plan_not_found | 422 / 404 | Bad or inactive plan_id |
| invalid_phone | 422 | Phone number format not recognized |
| idempotency_key_required | 422 | Missing idempotency_key |
| insufficient_balance | 402 | Account & Wallet too low |
| all_providers_unavailable | 502 | Every provider failed; refunded automatically |
| wallet_error | 500 | Internal error during wallet debit |
Webhooks
Register a URL from your developer dashboard to receive real-time notifications instead of polling.
Events sent: purchase.completed, purchase.failed, wallet.low_balance
Delivery: POST to your URL with a JSON body matching the event. Headers include X-Webhook-Event and X-Webhook-Signature (HMAC-SHA256 of the payload, using your webhook secret). Verify it before trusting the payload. Retries with backoff (1min, 5min, 30min, 2hr), then stops.
Example verification (PHP):
$signature = hash_hmac('sha256', file_get_contents('php://input'), $yourSecret);
if (!hash_equals($signature, $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'])) {
http_response_code(401);
exit;
}Rate limits
Each key has its own per-minute limit (default 60/min), set when the key is created. Exceeding it returns rate_limit_exceeded (429).
Questions or issues? Reach out through your developer dashboard.
Reseller API — Recharge PIN
Purchase printable Nigerian recharge PINs programmatically using your Billam developer wallet. Successful responses contain the recharge PIN and serial number for each card.
Base URL: https://billam.com.ng/api/
Authentication
Recharge PIN uses the same developer key and Bearer-token authentication as the Data Reseller API:
Authorization: Bearer <public_key>.<secret>| Endpoint | Required scope |
|---|---|
| GET /reseller-recharge-pin-plans.php | plans:read |
| POST /reseller-recharge-pin-purchase.php | purchase:write |
| GET /reseller-recharge-pin-order.php | purchase:write |
Supported networks and denominations
| Network | Denominations |
|---|---|
| MTN | ₦100, ₦200, ₦500, ₦1,000 |
| AIRTEL | ₦100, ₦200, ₦500, ₦1,000 |
| GLO | ₦100, ₦200, ₦500, ₦1,000 |
| 9MOBILE | ₦100, ₦200, ₦500, ₦1,000 |
A single request may purchase between 1 and 60 cards of one network and denomination.
GET /reseller-recharge-pin-plans.php
Returns Recharge PIN denominations and your current server-authoritative reseller price. Optionally filter using network.
curl "https://billam.com.ng/api/reseller-recharge-pin-plans.php?network=MTN" \
-H "Authorization: Bearer $TELECLASP_API_KEY"Example response:
{
"success": true,
"plans": [
{
"network": "MTN",
"denomination": "100.00",
"denomination_kobo": 10000,
"discount_percent": "2.50",
"unit_price": "97.50",
"min_quantity": 1,
"max_quantity": 60
}
]
}unit_price is the amount charged from your developer wallet for one card at the current rate. Always use the latest plans response rather than hardcoding pricing.
POST /reseller-recharge-pin-purchase.php
Purchases one or more cards of the same network and denomination.
curl https://billam.com.ng/api/reseller-recharge-pin-purchase.php \
-X POST \
-H "Authorization: Bearer $TELECLASP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"network": "MTN",
"denomination": 100,
"quantity": 5,
"business_name": "Taiwo Communications",
"idempotency_key": "rp-order-20260910-0001"
}'Request fields:
| Field | Required | Description |
|---|---|---|
| network | Yes | MTN, AIRTEL, GLO, or 9MOBILE |
| denomination | Yes | 100, 200, 500, or 1000 |
| quantity | Yes | Number of cards, from 1 to 60 |
| business_name | No | Name to associate with printable cards |
| idempotency_key | Yes | Your unique identifier for this purchase attempt |
idempotency_key for every new purchase. If a network request is interrupted, retry the same request with the same key. Do not create a new key until the previous order outcome is known.Successful response:
{
"success": true,
"order_uid": "RPR_20260910163000_ABCD123456",
"network": "MTN",
"denomination": "100.00",
"quantity": 2,
"business_name": "Taiwo Communications",
"face_value": "200.00",
"amount": "195.00",
"discount_percent": "2.50",
"discount_amount": "5.00",
"pins": [
{
"pin": "1234567890123456",
"serial": "20842836688272089595",
"serial_number": "20842836688272089595"
},
{
"pin": "9876543210987654",
"serial": "20842836688272089596",
"serial_number": "20842836688272089596"
}
],
"reference": "RPR_...",
"status": "completed",
"timestamp": "2026-09-10T16:30:00+01:00"
}Pending provider confirmation
Telecom/provider requests are not always immediately conclusive. If Billam cannot safely determine whether a provider supplied the PIN, the order is kept pending instead of purchasing the same card again from another provider.
HTTP 202
{
"success": false,
"error": "purchase_processing",
"order_uid": "RPR_...",
"status": "pending"
}When you receive this response, do not create a second purchase. Store the order_uid and query the order endpoint.
GET /reseller-recharge-pin-order.php
Retrieves a specific Recharge PIN order owned by the authenticated developer. Completed orders return their original PINs and serial numbers, which makes server-side recovery possible after an interrupted client response.
curl "https://billam.com.ng/api/reseller-recharge-pin-order.php?order_uid=RPR_..." \
-H "Authorization: Bearer $TELECLASP_API_KEY"A pending order returns HTTP 202. A completed order returns HTTP 200 with its original PIN array.
Idempotency
Recharge PIN purchasing is idempotent per developer. Reusing an idempotency key with the same purchase details returns the existing order instead of charging for another batch. Reusing it with different details returns idempotency_conflict.
Provider failover
Billam manages fulfillment internally. Your integration does not select a provider.
Local Billam inventory
↓
ClubKonnect
↓ (definite non-fulfillment only)
StrowalletExplicit stock failures may safely fall through to the next source. Timeouts or ambiguous provider responses do not — the order becomes pending to prevent duplicate PIN purchases.
Error codes
| Code | Status | Meaning |
|---|---|---|
| authentication_required | 401 | Bearer token missing |
| invalid_token | 401 | API token is invalid |
| key_revoked | 401 | API key has been revoked |
| invalid_scope | 403 | API key lacks the required scope |
| rate_limit_exceeded | 429 | API key rate limit exceeded |
| invalid_network | 422 | Unsupported network |
| invalid_plan | 422 | Unsupported network or denomination |
| invalid_quantity | 422 | Quantity must be between 1 and 60 |
| invalid_business_name | 422 | Business name is invalid |
| idempotency_key_required | 422 | A unique idempotency key is required |
| idempotency_conflict | 409 | Key was previously used for different purchase details |
| insufficient_balance | 402 | Developer wallet cannot cover the purchase |
| purchase_processing | 202 | Provider outcome requires confirmation; do not create another purchase |
| all_providers_unavailable | 502 | No source could supply the cards; held wallet amount was released |
| order_not_found | 404 | Order does not belong to the authenticated developer or does not exist |
| fulfillment_unavailable | 409 | Completed fulfillment could not safely be returned |
Production checklist
- Call the API only from your backend/server.
- Keep your Bearer token outside source control.
- Generate and persist an idempotency key before every purchase.
- Store the returned
order_uid. - Treat HTTP 202 as pending — never immediately repurchase.
- Protect returned PIN and serial values as monetary-value secrets.
- Fetch current pricing from the plans endpoint.
Reseller API — Electricity
Validate a meter and purchase prepaid or postpaid electricity programmatically using your Billam developer wallet. Prepaid purchases return a vending token; postpaid purchases settle the customer's outstanding balance.
Base URL: https://billam.com.ng/api/
Authentication
Electricity uses the same developer key and Bearer-token authentication as the Data and Recharge PIN Reseller APIs:
Authorization: Bearer <public_key>.<secret>| Endpoint | Required scope |
|---|---|
| GET /reseller-electricity-providers.php | plans:read |
| POST /reseller-electricity-validate.php | purchase:write |
| POST /reseller-electricity-purchase.php | purchase:write |
| GET /reseller-electricity-order.php | purchase:write |
Supported distribution companies
| Code | Name | Meter types |
|---|---|---|
| IKEJA | Ikeja Electric (IKEDC) | Prepaid, Postpaid |
| EKO | Eko Electric (EKEDP) | Prepaid, Postpaid |
| ABUJA | Abuja (AEDC) | Prepaid, Postpaid |
| IBADAN | Ibadan (IBEDC) | Prepaid, Postpaid |
| ENUGU | Enugu (EEDC) | Prepaid, Postpaid |
| BENIN | Benin (BEDC) | Prepaid, Postpaid |
| JOS | Jos (JED) | Prepaid, Postpaid |
| KADUNA | Kaduna Electric (KAEDCO) | Prepaid, Postpaid |
| KANO | Kano (KEDCO) | Prepaid, Postpaid |
| PH | Port Harcourt (PHED) | Prepaid, Postpaid |
| YOLA | Yola (YEDC) | Prepaid, Postpaid |
| ABA | Aba Electric | Prepaid, Postpaid |
Purchase amount must be between ₦100 and ₦50,000 per transaction.
GET /reseller-electricity-providers.php
Returns every supported distribution company along with the supported meter types and purchase limits.
curl "https://billam.com.ng/api/reseller-electricity-providers.php" -H "Authorization: Bearer $TELECLASP_API_KEY"Example response:
{
"success": true,
"providers": [
{
"code": "IKEJA",
"name": "Ikeja Electric (IKEDC)",
"meter_types": ["PREPAID", "POSTPAID"],
"min_amount": "100.00",
"max_amount": "50000.00"
}
]
}POST /reseller-electricity-validate.php
Verifies a meter number before you charge the customer. Always validate before purchasing — the purchase endpoint also validates internally, but confirming details with your customer first avoids paying into a wrong meter.
curl https://billam.com.ng/api/reseller-electricity-validate.php -X POST -H "Authorization: Bearer $TELECLASP_API_KEY" -H "Content-Type: application/json" -d '{
"disco": "IKEJA",
"meter_type": "PREPAID",
"meter_number": "04123456789"
}'Successful response:
{
"success": true,
"disco": "IKEJA",
"disco_name": "Ikeja Electric (IKEDC)",
"meter_type": "PREPAID",
"meter_number": "04123456789",
"customer_name": "John Doe",
"customer_address": "10 Example Street, Lagos",
"meter_serial": "04123456789",
"account_number": "04123456789"
}POST /reseller-electricity-purchase.php
Validates the meter, then charges your developer wallet and fulfills the purchase. Prepaid responses include a vending token and units; postpaid responses confirm the bill was paid.
curl https://billam.com.ng/api/reseller-electricity-purchase.php -X POST -H "Authorization: Bearer $TELECLASP_API_KEY" -H "Content-Type: application/json" -d '{
"disco": "IKEJA",
"meter_type": "PREPAID",
"meter_number": "04123456789",
"amount": 1000,
"idempotency_key": "elec-order-20260912-0001"
}'Request fields:
| Field | Required | Description |
|---|---|---|
| disco | Yes | Distribution company code, e.g. IKEJA |
| meter_type | Yes | PREPAID or POSTPAID |
| meter_number | Yes | 6–20 digit meter number |
| amount | Yes | Naira amount, ₦100 to ₦50,000 |
| idempotency_key | Yes | Your unique identifier for this purchase attempt |
idempotency_key for every new purchase. If a network request is interrupted, retry the same request with the same key. Do not create a new key until the previous order outcome is known.Successful response (prepaid):
{
"success": true,
"order_uid": "RSE_20260912163000_ABCD123456",
"disco": "IKEJA",
"disco_name": "Ikeja Electric (IKEDC)",
"meter_type": "PREPAID",
"meter_number": "04123456789",
"customer_name": "John Doe",
"customer_address": "10 Example Street, Lagos",
"amount": "1000.00",
"token": "4024540897615148172",
"units": "10.42",
"reference": "RSEP_...",
"status": "completed",
"timestamp": "2026-09-12T16:30:00+01:00"
}For postpaid purchases, token and units are returned as empty strings.
Pending provider confirmation
Provider requests are not always immediately conclusive. If Billam cannot safely determine whether the provider fulfilled the purchase, the order is held pending instead of risking a duplicate vend.
HTTP 202
{
"success": false,
"error": "purchase_processing",
"order_uid": "RSE_...",
"status": "pending"
}When you receive this response, do not create a second purchase. Store the order_uid and query the order endpoint.
GET /reseller-electricity-order.php
Retrieves a specific electricity order owned by the authenticated developer. Completed orders return the original token and units, which makes server-side recovery possible after an interrupted client response.
curl "https://billam.com.ng/api/reseller-electricity-order.php?order_uid=RSE_..." -H "Authorization: Bearer $TELECLASP_API_KEY"A pending order returns HTTP 202. A completed order returns HTTP 200 with its original token and units.
Idempotency
Electricity purchasing is idempotent per developer. Reusing an idempotency key with the same purchase details returns the existing order instead of charging again. Reusing it with different details returns idempotency_conflict.
Error codes
| Code | Status | Meaning |
|---|---|---|
| authentication_required | 401 | Bearer token missing |
| invalid_token | 401 | API token is invalid |
| key_revoked | 401 | API key has been revoked |
| invalid_scope | 403 | API key lacks the required scope |
| rate_limit_exceeded | 429 | API key rate limit exceeded |
| invalid_disco | 422 | Unsupported distribution company |
| invalid_meter_type | 422 | Must be PREPAID or POSTPAID |
| invalid_meter_number | 422 | Meter number must be 6–20 digits |
| invalid_amount | 422 | Amount must be ₦100 to ₦50,000 |
| idempotency_key_required | 422 | A unique idempotency key is required |
| idempotency_conflict | 409 | Key was previously used for different purchase details |
| meter_validation_failed | 422 | Provider rejected the meter details |
| validation_temporarily_unavailable | 503 | Meter validation could not be confirmed; retry shortly |
| insufficient_balance | 402 | Developer wallet cannot cover the purchase |
| purchase_processing | 202 | Provider outcome requires confirmation; do not create another purchase |
| electricity_purchase_failed | 502 | Provider rejected the purchase; held wallet amount was released |
| order_not_found | 404 | Order does not belong to the authenticated developer or does not exist |
| purchase_not_completed | 409 | Order exists but has not completed |
Production checklist
- Call the API only from your backend/server.
- Keep your Bearer token outside source control.
- Validate the meter and confirm details with your customer before purchasing.
- Generate and persist an idempotency key before every purchase.
- Store the returned
order_uid. - Treat HTTP 202 as pending — never immediately repurchase.
- Protect returned vending tokens as monetary-value secrets.