This is used to purchase data for all networks and data types.
"Status" in API responses: successful, failed or processing
API Token: You are to pass your API token into the header 'Authorization' key for every request sent to our server. The value should be in the format "Token your-token" (where your-token is your API token).
Parameters:
| Parameter | Description |
|---|---|
| network | It can be either '1' for MTN, '2' for Glo, '3' for 9mobile or '4' for Airtel |
| plan | This is the plan ID. Check BELOW for the full plan codes. |
| mobile_number | Beneficiary phone number |
<?php
$postRequest = array(
'network' => $networkId,
'mobile_number' => $phone,
'plan' => $plan,
$xpostRequest=json_encode($postRequest);
$url= 'https://cash2bill.com/api/data/';
$cURLConnection = curl_init($url);
curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $xpostRequest);
curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURLConnection, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"Accept: application/json",
"Authorization: Token ".$your-token
));
$data = curl_exec($cURLConnection);
curl_close($cURLConnection);
$xdata= json_decode($data, true);
echo $data;
exit;
?>
{
"Status":"successful",
"ident":"202503280837823726ae834d34d",
"network":"1",
"balance_before":"5532.00",
"plan_type":"SME",
"balance_after":"5270.00",
"mobile_number":"07033333333",
"plan":"7",
"api_response":"Dear Customer, You have successfully shared 1GB Data to 2347033333333. Thankyou.",
"plan_network":"MTN",
"plan_name":"1GB",
"plan_amount":"262.00",
"create_date":"2025-03-28 08:37:14"
}
OR
{
"error":"You can't purchase this plan due to insufficient balance N109.00." Kindly Fund your Wallet"
}
OR
{
"detail":"Authentication credentials were not provided"
}
OR
{
"mobile_number":"This field is required"
}
OR
{
"plan":"This field is required"
}
| S/N | Plan Name | Plan Id |
|---|---|---|
| 1 | MTN SME 500MB | 1 |
| 2 | MTN SME 1GB | 2 |
| 3 | MTN SME 2GB | 3 |
| 4 | MTN SME 3GB | 4 |
| 5 | MTN SME 5GB | 5 |
| 6 | MTN SME 10GB | 6 |
| 7 | MTN SME2 500MB | 7 |
| 8 | MTN SME2 1GB | 8 |
| 9 | MTN SME2 2GB | 9 |
| 10 | MTN SME2 3GB | 10 |
| 11 | MTN SME2 5GB | 11 |
| 12 | MTN SME2 10GB | 12 |
| 13 | MTN DATASHARE 500MB | 13 |
| 14 | MTN DATASHARE 1GB | 14 |
| 15 | MTN DATASHARE 2GB | 15 |
| 16 | MTN DATASHARE 3GB | 16 |
| 17 | MTN DATASHARE 5GB | 17 |
| 18 | MTN CG 500MB | 18 |
| 19 | MTN CG 1GB | 19 |
| 20 | MTN CG 2GB | 20 |
| 21 | MTN CG 3GB | 21 |
| 22 | MTN CG 5GB | 22 |
| 23 | MTN CG 10GB | 23 |
| 24 | MTN CG 15GB | 24 |
| 25 | MTN CG 20GB | 25 |
| 26 | AIRTEL CG 500MB | 26 |
| 27 | AIRTEL CG 1GB | 27 |
| 28 | AIRTEL CG 2GB | 28 |
| 29 | AIRTEL CG 5GB | 29 |
| 30 | AIRTEL CG 10GB | 30 |
| 31 | AIRTEL CG 15GB | 31 |
| 32 | AIRTEL CG 20GB | 32 |
| 33 | GLO CG 500MB | 33 |
| 34 | GLO CG 1GB | 34 |
| 35 | GLO CG 2GB | 35 |
| 36 | GLO CG 3GB | 36 |
| 37 | GLO CG 5GB | 37 |
| 38 | GLO CG 10GB | 38 |
| 39 | 9MOBILE CG 500MB | 39 |
| 40 | 9MOBILE CG 1GB | 40 |
| 41 | 9MOBILE CG 2GB | 41 |
| 42 | 9MOBILE CG 3GB | 42 |
| 43 | 9MOBILE CG 5GB | 43 |
| 44 | 9MOBILE CG 10GB | 44 |
| 45 | 9MOBILE CG 15GB | 45 |
| 46 | 9MOBILE CG 20GB | 46 |
| 47 | AIRTEL CG 100MB | 47 |
| 48 | AIRTEL CG 300MB | 48 |