Purchase a particular amount of Airtime.
{{base_url}}
//vas/airtime/purchase
Parameter | Type | Details |
---|---|---|
serviceCategoryId | string | id_ of the network selected |
amount | decimal | Your Amount , Must be rounded at 2 precision. |
phoneNumber | string | Beneficiary Phone Number |
Request Example (guzzle)
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', '{{base_url}}//vas/airtime/purchase', [
'json' => [
'serviceCategoryId' => 'xxxxxxxxxxx',
'amount' => '100.00',
'phoneNumber' => 'xxxxxxxxxxx',
],
'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": "MOBILETOPUP Request Successful",
"data": {
"clientId": "673f225ce994ba0024cced6e",
"serviceCategoryId": "61e989f20e69308aa37a7a9f",
"reference": "4edfab8fab3f47e7819764a140b95ba5",
"status": "successful",
"amount": "500",
"id": "67d3f91132ebf265b484a585",
"reciever": {
"number": "08123456789",
"distribution": "MTN",
"vendType": "AIRTIME",
}
}
}
**Response: ERROR (403 FAILED)**
{
"message": {
"code": 403,
"error": [
"Requested with invalid token!"
]
},
"data": [],
"type": "error"
}