Data topup
Developers can use our HTTP APIs to quickly and easily integrate with their systems and applications.
Command:
https://bestdatanig.com/client/api/balance
Parameter:
Api key
$host = ‘https://bestdatanig.com/client/api/balance’;
$data = array( ‘api’ => ‘ap_xxxxxxxxxxxxxxxxxxx’ // API KEY );
$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => $host,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => “”,
CURLOPT_MAXREDIRS => 10,
CURLOPT_USERPWD => $username.”:” .$password,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION =>
CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => “POST”,
CURLOPT_POSTFIELDS => $data, ));
echo curl_exec($curl);
Command:
https://bestdatanig.com/client/api/pay/
Parameter:
Api key
serviceID (
MTN => MTN,
AIRTEL => airtel_airtime,
9MOBILE => ninemobile_airtime,
GLO => glo_airtime)
amount
phone (phone number)
<php
$api = “ap_************”;
$requestId = md5(mt_rand().time());
$host = ‘https://bestdatanig.com/client/api/pay/’;
$refer= (isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] === ‘on’ ? “https” : “http”) . “://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;
$data = array(
‘pin’ => “1111”
‘serviceID’=> “airtel_airtime”,
‘amount’ => “100”,
‘api’ => $api,
‘phone’=>’09013279555’,
‘requestID’ => $requestId
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $host,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_ENCODING => “”,
CURLOPT_POSTFIELDS => $data,
CURLOPT_REFERER => $refer,
CURLOPT_HTTPHEADER => array(“Authorization: Bearer $api”),
CURLOPT_FOLLOWLOCATION=> true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_POSTREDIR => 3,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => “POST”,
));
echo $r = curl_exec($curl);
echo curl_error($cur);
curl_close($curl);
$response = json_decode($r,true)
<
Command:
https://bestdatanig.com/client/api/pay/
Parameter:
Api key
serviceID (
MTN CG => mtncg1,
MTN SME => mtnsme2,
GLO DATA => glodata
AIRTEL DATA => AirtelCG1
9mobile => ninembdata
9mobile sme => ninembsme
plan : see plans here
amount
$api = “ap_********”;
$requestId = md5(mt_rand().time());
$host = ‘https://bestdatanig.com/api/pay/’;
$refer= (isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] === ‘on’ ? “https” : “http”) . “://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;
$data = array(
‘pin’ => “1111”
‘serviceID’=> “mtncg”,
‘plan’ => “225”,
‘amount’ => “120”,
‘api’ => $api,
‘phone’=>’07045598599’,
‘requestID’ => $requestId
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $host,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_ENCODING => “”,
CURLOPT_POSTFIELDS => $data,
CURLOPT_REFERER => $refer,
CURLOPT_HTTPHEADER => array(“Authorization: Bearer $api”),
CURLOPT_FOLLOWLOCATION=> true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_POSTREDIR => 3,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => “POST”,
));
echo $r = curl_exec($curl);
echo curl_error($cur);
curl_close($curl);
$response = json_decode($r,true);
Command:
https://bestdatanig.com/client/api/pay/
Parameter:
Api key
serviceID (gotv,dstv,startimes)
package : Click any of the services below to see their plans ID.
GOTV PACKAGE, DSTV PACKAGE, STARTIMES PACKAGE.
amount
billersCode (Decoder number)
phone (phone number)
To verify Decoder name: https://bestdatanig.com/client/api/verify
$host = ‘bestdatanig.com/client/api/pay’;
$refer= (isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] === ‘on’ ? “https” : “http”) . “://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;
$api = ‘ap_xxxxxxxxxxxxxxxxxxxx’; //Your API Key
$data = array( ‘serviceID’=> “gotv”, //Merchants or Operator ID ( gotv, dstv, startimes)
‘pin’ => “1111”
‘phone’=>”0703xxxxxxxxxx”, //integer
’email’ => “name@example.com”, //string
‘amount’ => 1000, // (Required) Amount to pay
‘requestID’ => time()+mt_rand() // unique for every transaction );
$curl = curl_init(); curl_setopt_array($curl,array(
CURLOPT_URL => $host,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_ENCODING => “”,
CURLOPT_POSTFIELDS => $data,
CURLOPT_REFERER => $refer,
CURLOPT_HTTPHEADER => array(“Authorization: Bearer $api”),
CURLOPT_FOLLOWLOCATION=> true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_POSTREDIR => 3,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION =>
CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => “POST”, )); $r = curl_exec($curl);
curl_close($curl);
print_r(json_decode($r,true))
Command:
https://bestdatanig.com/client/api/pay/
Parameter:
serviceID: See service ID’S for Electricity here
plan : (prepaid or postpaid)
billersCode : (Meter number)
amount
phone
Display value:
$token[“display_name”] = “Meter Token”;
$token[“name”] = “token”;
$customerName[“display_name”] = “customer Name”;
$customerName[“name”] = “customerName”;
$customerAddres[“display_name”] = “customer Addres”;
$customerAddres[“name”] = “addres”;
$units[“display_name”] = “units”;
$units[“name”] = “Units”;
$displayValue[ ]=$token;
$displayValue[ ]=$customerName;
$displayValue[ ]=$customerAddres;
$displayValue[ ]=$units;
echo json_encode($displayValue,JSON_PRETTY_PRINT);
?>
This endpoint allows you to generate recharge card.
Using a POST method, pins can be generated with the endpoint below:
LIVE : https://bestdatanig.com/client/apiV2/generate
FIELDS | DESCRIPTION |
network | The network of the pin. Mtn,Glo,9mobile,Airtel |
value | N100 or N200 or N500 or N1000 denomination. |
description | Description of the order. E.g “My first order”… It can be anything. |
Authorization | “Bearer apikey”…. Your api key can be found on your dashboard |
number | number of vouchers/pins to be generated. The minimum is 10. |
<?php $host = 'https://bestdatanig.com/client/apiV2/generate'; $refer= (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $api = 'ap_5b41cb8caae47eeea0c7264460e3bb26'; //Your API Key $data = array( 'network'=>"universal", //The network 'value' => 100, // (Required) Amount to generate 'number' => 10, // Number of Voucher to be generated. 'description' => "My first order", //Description on of the order ); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $host, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_ENCODING => "", CURLOPT_POSTFIELDS => $data, CURLOPT_REFERER => $refer, CURLOPT_HTTPHEADER => array("Authorization: Bearer $api"), CURLOPT_FOLLOWLOCATION=> true, CURLOPT_MAXREDIRS => 10, CURLOPT_POSTREDIR => 3, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", )); $r = curl_exec($curl); curl_close($curl); print_r(json_decode($r,true)); RESPONSES Below are list of Response Code and their respective meaning. '200':'TRANSACTION_SUCCESSFUL', '204':'REQUIRED_CONTENT_NOT_SENT', '206':'INVALID_CONTENT', '401':'AUTHORIZATION_FAILED', '402':'ERROR_IN_PAYMENT', '404':'CONTENT_NOT_FOUND', '405':'REQUEST_METHOD_NOT_IN_POST' '406':'NOT_ALLOWED', '502':'GATEWAY_ERROR'