Accept bank transfers in 3 steps
Your customers get their own bank account numbers. When they pay, your callback URL is called and you credit them automatically.
Get your API key
Dashboard, Developer, Reseller API, Create key. It starts with rsl_live_. Save it as the environment variable TELECLASP_KEY.
Create the customer bank accounts
$ch = curl_init("https://billam.com.ng/api/reseller-virtual-account.php");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("TELECLASP_KEY"), "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode(["customer_ref" => "user_1042", "customer_name" => "Ada Obi"]),
]);
$res = json_decode(curl_exec($ch), true);
print_r($res["accounts"]); // show these bank accounts to your customerYou get back Kuda and Paga account numbers. Show them to your customer. Repeat calls are safe.
Add your callback URL
Dashboard, Developer, Webhooks, paste your public HTTPS URL, and save the secret as TELECLASP_WEBHOOK_SECRET. Put this handler at that URL:
<?php // webhook.php (needs a table with a UNIQUE key on ref)
$raw = file_get_contents("php://input");
$sig = $_SERVER["HTTP_X_WEBHOOK_SIGNATURE"] ?? "";
// 1. Make sure it really came from Billam
if (!hash_equals(hash_hmac("sha256", $raw, getenv("TELECLASP_WEBHOOK_SECRET")), $sig)) {
http_response_code(401); exit;
}
$e = json_decode($raw, true);
if (($e["event"] ?? "") === "virtual_account.payment.received") {
$d = $e["data"];
$ref = $d["transaction_reference"]; // unique per payment
$user = $d["customer_ref"]; // the customer_ref you sent when creating
$amount = (float)$d["amount_credited"];
// 2. Credit exactly once. Repeats are ignored by the unique key.
$db->beginTransaction();
$ins = $db->prepare("INSERT IGNORE INTO funding_log (ref, user_id, amount) VALUES (?, ?, ?)");
$ins->execute([$ref, $user, $amount]);
if ($ins->rowCount() === 1) {
$db->prepare("UPDATE users SET balance = balance + ? WHERE id = ?")->execute([$amount, $user]);
}
$db->commit();
}
http_response_code(200); // 3. Always answer 200 quicklyVirtual Accounts
Give each of your customers dedicated NGN bank account numbers on Kuda MFB and Paga. When a customer transfers money, your Billam wallet is credited minus the funding fee, and your webhook is notified.
https://billam.com.ng/api| Method | Endpoint |
|---|---|
| POST | /reseller-virtual-account.php |
| GET | /reseller-virtual-account.php |
| GET | /reseller-virtual-account-fees.php |
| GET | /reseller-virtual-account-transactions.php |
Authentication
Create a Reseller API key in your dashboard under Developer, then Reseller API. It starts with rsl_live_ and needs no extra permissions. Gateway keys (tc_live_) do not work here. Send the key as a Bearer token on every request.
Authorization: Bearer rsl_live_<id>.<secret> Content-Type: application/json
Create accounts
POST /reseller-virtual-account.php
| Field | Required | Notes |
|---|---|---|
customer_ref | Yes | Your unique customer ID |
customer_name | Yes | Max 191 characters. Becomes the account name |
customer_email | No | Valid email, max 254 characters |
curl -X POST https://billam.com.ng/api/reseller-virtual-account.php \
-H "Authorization: Bearer $TELECLASP_KEY" \
-H "Content-Type: application/json" \
-d '{"customer_ref":"user_1042","customer_name":"Ada Obi","customer_email":"ada@example.com"}'Response 200:
{
"success": true,
"customer_ref": "user_1042",
"currency": "NGN",
"accounts": [
{ "provider": "KUDA", "bank_name": "Kuda MFB", "bank_code": "090267",
"account_number": "3001234567", "account_name": "ADA OBI", "status": "active" },
{ "provider": "PAGA", "bank_name": "Paga", "bank_code": "100002",
"account_number": "1234567890", "account_name": "ADA OBI", "status": "active" }
],
"provider_errors": []
}- Idempotent per bank. Repeat calls with the same customer_ref return existing accounts and only create missing ones.
- If one bank is down you still get 200 with the other account. The failed bank is listed in provider_errors. Retry later with the same customer_ref.
- Show every account returned. Customers can pay into any of them.
List accounts
GET /reseller-virtual-account.php returns all your accounts.
GET /reseller-virtual-account.php?customer_ref=user_1042 returns one customer.
Funding fee
A percentage fee with a cap is deducted from each inbound transfer before your wallet is credited. The rate can change, so read it from the API instead of hard-coding it.
GET /reseller-virtual-account-fees.php
{ "success": true, "currency": "NGN", "percentage": "0.50", "cap": "300.00",
"charge_bearer": "wallet_owner" }Example at 0.50 percent: a 3,000 naira transfer costs 15 naira and credits 2,985 naira.
Payments
GET /reseller-virtual-account-transactions.php returns your latest 100 payments. Add ?customer_ref=user_1042 to filter. Each item has transaction_reference, provider_reference, customer_ref, provider, account_number, gross_amount, fee, amount_credited, currency, sender_name, sender_bank, wallet_reference, status, received_at and credited_at.
Webhooks
Register your webhook URL in the dashboard. Each credited transfer sends a POST with header X-Webhook-Event: virtual_account.payment.received and header X-Webhook-Signature, the hex HMAC-SHA256 of the raw body keyed with your endpoint secret.
{
"event": "virtual_account.payment.received",
"data": {
"transaction_reference": "...",
"provider_reference": "...",
"customer_ref": "user_1042",
"provider": "KUDA",
"account_number": "3001234567",
"bank_name": "Kuda MFB",
"gross_amount": "3000.00",
"fee": "15.00",
"amount_credited": "2985.00",
"currency": "NGN",
"sender_name": "...",
"sender_bank": "...",
"wallet_reference": "WCR_..."
}
}Verify the signature, then credit once:
$raw = file_get_contents("php://input");
$sig = $_SERVER["HTTP_X_WEBHOOK_SIGNATURE"] ?? "";
if (!hash_equals(hash_hmac("sha256", $raw, $WEBHOOK_SECRET), $sig)) {
http_response_code(401); exit;
}
$e = json_decode($raw, true);
if ($e["event"] === "virtual_account.payment.received") {
// credit your customer ONCE per $e["data"]["transaction_reference"]
}
http_response_code(200);- Respond 200 quickly. Failed deliveries are retried.
- Deliveries can repeat. Credit once per transaction_reference.
- amount_credited is what reached your wallet after the fee.
Test your webhook in 30 seconds
This sends a signed fake payment to your own URL. Replace the secret and the URL, then run it. Run it twice: the first call should credit the customer and the second must not.
SECRET="your_webhook_secret"
BODY='{"event":"virtual_account.payment.received","data":{"transaction_reference":"TEST-001","customer_ref":"user_1042","amount_credited":"100.00","currency":"NGN"}}'
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" | awk '{print $NF}')
curl -i -X POST https://yourapp.com/teleclasp/webhook \
-H "X-Webhook-Signature: $SIG" -H "Content-Type: application/json" -d "$BODY"Then do one real 100 naira transfer to a test account and watch it appear under Payments in your dashboard.
Make auto-funding bulletproof
- Always verify the signature on the raw body before trusting the payment.
- Answer 200 within a few seconds. Do slow work after you respond.
- Failed deliveries are retried automatically, so the same payment can arrive more than once.
- Credit once per transaction_reference, enforced with a UNIQUE key in your database.
- If your server was down, fetch missed payments and credit any you have not seen:
curl https://billam.com.ng/api/reseller-virtual-account-transactions.php?customer_ref=user_1042 \ -H "Authorization: Bearer $TELECLASP_KEY"
| Problem | Fix |
|---|---|
| Webhook never arrives | Your URL must be public and HTTPS, and the endpoint must be active under Developer, then Webhooks. |
| Your handler returns 401 | Verify against the RAW request body, not re-encoded JSON, and use the secret for that endpoint. |
| Customer credited twice | Add a UNIQUE key on transaction_reference and credit only when the insert succeeds. |
| Wrong amount credited | Credit amount_credited (after the fee), not gross_amount, unless you choose to absorb the fee. |
| Customer not found | customer_ref must equal the ID you used when creating the accounts. Use your own user ID. |
| 502 when creating accounts | One or both banks are down. Retry with the same customer_ref. |
Errors
Errors return success false and an error code.
| HTTP | error | Meaning |
|---|---|---|
| 400 | invalid_json | Body is not valid JSON |
| 401 | authentication_required, malformed_token, invalid_token, key_revoked | Problem with the API key |
| 403 | invalid_scope | This key cannot use this endpoint. Use a Reseller API key |
| 405 | method_not_allowed | Use GET or POST |
| 422 | validation_error | Missing or invalid field (see message) |
| 429 | rate limited | Too many requests, slow down |
| 500 | service_unavailable | Temporary fault, retry |
| 502 | providers_unavailable | Both banks down, retry with the same customer_ref |
Go live
- Use a Reseller API key (starts with rsl_live_), not a Gateway key.
- Call POST once when a customer first needs to fund. Store the returned accounts.
- Show bank name, account number and account name.
- Implement the webhook with signature check and one-time crediting.
- Handle provider_errors and 502 with a retry using the same customer_ref.
- Keep your API key and webhook secret in environment variables.