Purchase electricity units using this endpoint. It is a POST method, you'll need your authorization token and parameters stated below to smed request.
{{base_url}}
/vas/electricity/purchase
Parameter | Type | Details |
---|---|---|
serviceCategoryId | string | id_ of the network selected |
meterNumber | string | The meter number of the account you want to top up. |
amount | decimal | Your Amount , Must be rounded at 2 precision. |
vendType | string | PREPAID,POSTPAID...etc. |
Request Example (guzzle)
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', '{{base_url}}/vas/electricity/purchase', [
'json' => [
'serviceCategoryId' => 'xxxxxxxxxxx',
'meterNumber' => 'xxxxxxxxxx',
'amount' => '100.00',
'vendType' => 'PREPAID',
],
'headers' => [
'Authorization' => 'Bearer {{access_token}}',
'client-id' => 'sdaH23sE5Th4*******dDF4df',
'accept' => 'application/json',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
**Response: SUCCESS (200 OK)**
{
"statusCode": 200,
"message": "BILLPAY Request Successful.",
"data": {
"clientId": "673f225ce994ba0024cced6e",
"serviceCategoryId": "61e989f20e69308aa37a7a9f",
"reference": "4edfab8fab3f47e7819764a140b95ba5",
"status": "successful",
"amount": "500",
"id": "67d3f91132ebf265b484a585",
"utilityToken": "ssfs-erfedde-srfdf",
"metaData": {
"id": 80376037,
"amountGenerated": 2883.72093023256,
"tariff": null,
"debtAmount": 0,
"debtRemaining": 0,
"disco": "JOS",
"orderId": "d06d071620bc4fe392350d97e2882588",
"receiptNo": "27459607964850442",
"tax": 216.27906976744,
"vendType": "",
"token": "7222-4007-9966-7341-7875",
"totalAmountPaid": 3100,
"vendAmount": 0,
"vendRef": "27459607964850442",
"responseCode": "100",
"responseMessage": "Payment was successful",
"address": "xxxxxxxxx",
"name": "xxxxxxxxxx",
"phoneNo": null,
"charges": 0,
"tariffClass": "NON MD BAND A",
}
"reciever": {
"number": "123456789",
"customerNumber": null,
"distribution": null,
"vendType": null,
}
"buyer_info": {
}
}
}
**Response: ERROR (403 FAILED)**
{
"message": {
"code": 403,
"error": [
"Requested with invalid token!"
]
},
"data": [],
"type": "error"
}