URL: /api/electricapi
Methods: POST, GET
This API endpoint allows users to purchase electric credits.
To access this endpoint, users must include their API key and secret key in the request headers.
See usage example in the code snippets below:
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" to avoid whitespace issue
"secondLevel": "prepaid", // value of this key can either be secondLevel or sId, e.g. "prepaid" to avoid whitespace issue
"amount": 1000
}
Response:
- Status Code: 200
{
"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.
{
"error": "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,
}
}
See usage example in the code snippets below:
GET request for available firstLevel and secondLevel:
Content-Type: application/json
api-key: your-api-key
secret-key: your-secret-key
Response:
- Status Code: 200
[
{
"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.