๐ API Documentation
Integrate data bundle purchases into your app seamlessly.
Wallet balance must be sufficient before order creation.
๐ Authentication
Include your API key in request headers:
Authorization: Bearer YOUR_API_KEY Content-Type: application/json
๐ Endpoint
POST
https://idatagh.com/wp-json/custom/v1/place-order
https://idatagh.com/wp-json/custom/v1/place-order
Creates a new data bundle order.
๐ก Networks
mtn telecel airteltigo
๐ฆ Request Body
{
"network": "mtn",
"beneficiary": "0547264035",
"pa_data-bundle-packages": 2
}
โ Success Response (200)
{
"status": "success",
"order_id": 1669242,
"amount": 8.3,
"network": "MTN",
"beneficiary": "0547264035"
}
๐ฐ Check Wallet Balance
Retrieve your current wallet balance.
GET
https://idatagh.com/wp-json/custom/v1/wallet-balance
https://idatagh.com/wp-json/custom/v1/wallet-balance
Success Response (200 OK)
{
"status": "success",
"balance": 3471.44
}
๐ฆ Check Order Status
Check the status of a specific order using order_id.
GET
https://idatagh.com/wp-json/custom/v1/order-status/2467764
https://idatagh.com/wp-json/custom/v1/order-status/2467764
Success Response (200 OK)
{
"status": "success",
"order_id": 1866162,
"order_status": "Completed",
"amount": 4.15
}
๐ฆ Fetch Data Packages
Fetch data packages of a specific network (MTN, Telecel & Airteltigo).
GET
https://idatagh.com/wp-json/custom/v1/packages?network=mtn
https://idatagh.com/wp-json/custom/v1/packages?network=mtn
Success Response (200 OK)
{
"status": "success",
"network": "MTN",
"packages": [
{
"package_id": 10497,
"label": "1",
"price": 4.15,
"data_size": 1
},
{
"package_id": 10501,
"label": "2",
"price": 8.3,
"data_size": 2
},
{
"package_id": 10531,
"label": "3",
"price": 12.45,
"data_size": 3
},
{
"package_id": 10503,
"label": "4",
"price": 16.6,
"data_size": 4
},
{
"package_id": 10505,
"label": "5",
"price": 20.75,
"data_size": 5
}
]
}
๐ Set Webhook URL
Register a URL to receive real-time order status updates. A webhook secret is generated automatically the first time you save a URL, and reused on future updates.
POST
https://idatagh.com/wp-json/custom/v1/webhook-settings
https://idatagh.com/wp-json/custom/v1/webhook-settings
Request Body
{
"webhook_url": "https://yourapp.com/webhook"
}
Success Response (200 OK)
{
"status": "success",
"message": "Webhook URL saved successfully",
"webhook_url": "https://yourapp.com/webhook",
"webhook_secret": "a1b2c3d4e5f6...64-char-hex-secret"
}
Store your
webhook_secret securely โ it’s used to verify that incoming webhook requests actually came from us.๐ก Webhook Events
Once a webhook URL is set, your endpoint receives a POST request every time an order’s status changes. The event name follows the pattern order.{status}.
| Order Status | Event | Meaning |
|---|---|---|
| rejected | order.rejected |
Order has been rejected |
| processing | order.processing |
Payment received, order being fulfilled |
| completed | order.completed |
Data bundle delivered successfully |
| cancelled | order.cancelled |
Order cancelled |
| refunded | order.refunded |
Order refunded |
| failed | order.failed |
Order failed (e.g. provider error) |
Most orders are already in
processing or completed by the time you receive your first webhook, since wallet payment is completed at order creation.๐จ Webhook Payload
{
"event": "order.completed",
"order_id": 4821,
"status": "completed",
"status_label": "Completed",
"amount": 24.50,
"network": "MTN",
"beneficiary": "0551234567",
"created_at": "2026-08-25 10:32:11"
}
Request Headers
| Header | Value |
|---|---|
| Content-Type | application/json |
| X-Tera-Signature | HMAC-SHA256 signature of the raw body, signed with your webhook_secret |
๐ก๏ธ Verifying the Signature
Compute an HMAC-SHA256 hash of the raw request body using your webhook_secret, and compare it to the X-Tera-Signature header.
PHP
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_TERA_SIGNATURE'] ?? '';
$expected = hash_hmac('sha256', $payload, $your_webhook_secret);
if (!hash_equals($expected, $signature)) {
http_response_code(401);
exit('Invalid signature');
}
Node.js
const crypto = require('crypto');
const expected = crypto
.createHmac('sha256', yourWebhookSecret)
.update(rawBody)
.digest('hex');
if (expected !== req.headers['x-tera-signature']) {
return res.status(401).send('Invalid signature');
}
Your endpoint should respond with a
2xx status within 20 seconds. There is currently no automatic retry on failed delivery.