Electricity Purchase Endpoint
Purchase electricity credits.
Endpoint
URL: /api/electricapi
Methods: POST, GET
Description
This API endpoint allows users to purchase electricity credits.
Authentication
To access this endpoint, users must include their API key and secret key in the request headers.
Request Headers
- api-key (string, required): The API key of the user.
- secret-key (string, required): The secret key of the user.
Request Body (POST)
- number (string, required): The meter number to recharge.
- firstLevel (string, required): The electricity disco.
- secondLevel (string, required): The type of meter, prepaid or postpaid.
- amount (number, required): The amount to purchase.
- requestId (string, optional): The unique request identifier which you can use to query processed transaction. 5-50 characters long.
Usage Example
POST request to purchase electricity:
Content-Type: application/json
api-key: your-api-key
secret-key: your-secret-key
{
"number": "0000000000",
"firstLevel": "IKEDC", // value of this key can either be firstLevel or fId, e.g. "ikedc" fId is more accurate
"secondLevel": "prepaid", // value of this key can either be secondLevel or sId, e.g. "prepaid" sId is more accurate
"amount": 1000,
"requestId": "yourreference"
}Response:
{
"message": "Transaction successful",
"data": {
"transactionId": "1234567890",
"email": "user@example.com",
"activity": "IKEDC",
"message": "prepaid",
"status": "Successful",
"recipient": "0000000000",
"token": "12234323464565434",
"unit": "11110",
"amount": 1000,
"amountUsed": 990,
"initialBalance": 5000,
"finalBalance": 4010
"Method": API,
}
}
- The amountUsed field represents the actual amount deducted from the user's balance based on user level.
Failed Response Format
{
"message": "Transaction failed",
"data": {
"transactionId": "1234567890",
"email": "user@example.com",
"activity": "IKEDC",
"message": "prepaid",
"status": "Failed",
"recipient": "0000000000",
"amount": 1000,
"initialBalance": 5000,
"finalBalance": 5000
"Method": API,
}
}GET Request
Get the list of available firstLevel and secondLevel:
Content-Type: application/json api-key: your-api-key secret-key: your-secret-key
Response:
[
{
"available": true,
"firstLevel": "Ikeja Electric (IKEDC)",
"fId": "ikeja-electric-ikedc",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
},
{
"available": true,
"firstLevel": "Eko Electric (EKEDC)",
"fId": "eko-electric-ekedc",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
},
{
"available": true,
"firstLevel": "Kano Electric (KEDCO)",
"fId": "kano-electric-kedco",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
},
{
"available": true,
"firstLevel": "Portharcourt Electric (PHED)",
"fId": "portharcourt-electric-phed",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
},
{
"available": true,
"firstLevel": "Jos Electric (JED)",
"fId": "jos-electric-jed",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
},
{
"available": true,
"firstLevel": "Ibadan Electric (IBEDC)",
"fId": "ibadan-electric-ibedc",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
},
{
"available": true,
"firstLevel": "Kaduna Electric (KAEDCO)",
"fId": "kaduna-electric-kaedco",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
},
{
"available": true,
"firstLevel": "Abuja Electric (AEDC)",
"fId": "abuja-electric-aedc",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
},
{
"available": true,
"firstLevel": "Enugu Electric (EEDC)",
"fId": "enugu-electric-eedc",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
},
{
"available": true,
"firstLevel": "Benin Electric (BEDC)",
"fId": "benin-electric-bedc",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
},
{
"available": true,
"firstLevel": "Aba Electric (ABA)",
"fId": "aba-electric-aba",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
},
{
"available": true,
"firstLevel": "Yola Electric (YEDC)",
"fId": "yola-electric-yedc",
"amounts": [null],
"secondLevels": [
{
"available": true,
"secondLevel": "prepaid",
"sId": "prepaid",
"amounts": [100]
},
{
"available": true,
"secondLevel": "postpaid",
"sId": "postpaid",
"amounts": [100]
}
]
}
]
- The amount field represents the percentage of the actual amount deducted from the user's balance based on user level.