ABTOSPAY API:- is one of the best and simple VTU online/mobile recharge api, with our API you can easily integrate Bill Payment, Airtime Purchase, TV Subscription e.t.c, on your website
but before you do anything, you should create a free ABTOSPAY Account account. Then
we will provide you with API Keys that you can use to make API calls.
GET API FOR FREE
Authenticate your API calls by including your API KEY in the Authorization header of every request for purchase and subscription. You can manage your API keys from the dashboard. Your API KEY should be kept secret, If for any reason you believe your secret key has been compromised or you wish to reset them, you can do so from the dashboard. But you don't need authentication to access some part of our API. You can simply make GET Request to query Data.
Use this request to get the list of all Category in our platform.
[ { "displayName": "Electricity Bill", "name": "electricity" }, { "displayName": "Mobile VTU", "name": "mobile_vtu" } ]
A valid response of this request will get the list of all services in a particular Category.
[ { "displayName": "MTN VTU", "name": "mtn_vtu", "image": "\/\/vtu.com\/uploads\/service\/xxxxx.jpg", "max": "5000000000", "min": "5", "fee": "100", "planName": "plan", //ignored when not available "feePercentage": true, "feeCapped": "3" } ]
Request the details of a particular Service including Name, Logo, Amount, Convenience Fee, Product Type, Minimum and Maximum Amount Allowed, it helps in billing customer and payment validation during transactions, with this, you don't necessary need to get all the details of the service from the User End you can dynamically query each service from your Back end.
{ "displayName": "MTN VTU", "name": "mtn_vtu", "image": "\/\/vtu.com\/uploads\/service\/xxxxxx.jpg", "planName": "plan", //ignored when not available "max": "5000000000", "min": "5", "fee": "100", "feePercentage": true, "feeCapped": "3" }
This request helps to get the list of available field on a particular service.
{ "service": "9mobile", "field": [ { "displayName": "Amount", "name": "amount", "type": "number", "description": "", "regExp": "[0-9]+", "required": true }, { "displayName": "Email", "name": "email", "type": "email", "description": "", "regExp": "", "required": false }, { "displayName": "Phone", "name": "phone", "type": "text", "description": "This is the description", "regExp": "[0-9]+", "required": true }, { "displayName": "Recharge Time", "name": "Date", "type": "date", "description": "", "regExp": "", "required": false } ] }
This request helps to get the list of available plans on a particular service. We are using the Variation for Plan in some case ( Variation is a change or slight difference in condition, amount, or level, typically within certain limits )
{ "service": "Glo Data", "PlanName": "plan", "fixedPrice": true, "plans": [ { "displayName": "10000 mb for USD10", "value": "10000-mb", "price": "100" }, { "displayName": "1month unlimited for 30USD", "value": "1mon-unlimited", "price": "30" }, { "displayName": "1 year unlimited for 200USD", "value": "1yr-unlimited", "price": "200" } ] }
Query the details of a particular variation including Amount, Variation Name and value, it helps in billing customer, display information Dynamic before/after Payment
{ "service": "GoTV", "PlanName": "gotv-plan", "fixedPrice": true, "plans": [ { "displayName": "gotv Plus", "value": "gotv-plus", "price": "100" } ] }
For testing payment use: abtospay.com/api/testpay
There two types of payment, the payment for FIX Service (TV Subscription, Data Plan) which has a fixed amount and plan and the payment for Flexible services like Airtime Purchase.
You don't need to know the type of payment for each service, you can dynamically request a service details like Name, Minimum and Maximum Amount Allowed and the type as well with our API. The good news is that our system successfully detect your payment type automatically.
Parameter for each type of payment are describe below.
Flexible payment is the payment for service like Airtime Purchase and bellow are the parameter for Flexible payment.
Field | Type | Description |
---|---|---|
api | key |
(Required) Your API Authetification to access your account |
requestID | Interger |
(Required). A unique code for every transaction |
serviceID | String |
serviceID (Required). Merchants or Operator ID ( gotv, glo, mtm-data, airtel etc) |
amount | Float |
Amount (Required). Amount paying without Chargers |
phone | string |
Phone Number (Required without country code). |
String |
Email Address (Optional) |
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'abtospay.com/api/pay.php', CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_ENCODING => "", CURLOPT_POSTFIELDS => 'serviceID=mtn_corperate_data&plan=1&amount=20&phone=08106178972&api=ap_d62f19a28fd6be74d1dbb894f74f2', CURLOPT_REFERER => $refer, CURLOPT_HTTPHEADER => array("Authorization: Bearer "), 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); curl_close($curl); print_r(json_decode($r,true));
Flexible payment is the payment for service like Airtime Purchase and bellow are the parameter for Flexible payment.
Field | Type | Description |
---|---|---|
api | key |
(Required) Your API Authetification to access your account |
requestID | Interger |
(Required). A unique code for every transaction |
serviceID | String |
serviceID (Required). Merchants or Operator ID ( gotv, glo, mtm-data, airtel etc) |
plan | String |
The plan Subscribing for (gotv-plus, gotv-value etc) |
amount | Float |
Amount (Required). Amount paying without Chargers |
customerID | String |
(e.g Dstv SmartCard Number) (Required). |
phone | string |
Phone Number (Required without country code). |
String |
Email Address (Optional) |
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'abtospay.com/api/pay.php', CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_ENCODING => "", CURLOPT_POSTFIELDS => 'serviceID=mtn_corperate_data&plan=1&amount=20&phone=08106178972&api=ap_d62f19a28fd6be74d1dbb894f74f2', CURLOPT_REFERER => $refer, CURLOPT_HTTPHEADER => array("Authorization: Bearer "), 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); curl_close($curl); print_r(json_decode($r,true));
Response Both Flexible and FIX
The response for Flexible and Fix look similar, just that some Array or json key are left blank if not applicable to the service
Array ( [code] => 200 [status] => TRANSACTION_SUCCESSFUL [description] => TRANSACTION_SUCCESSFUL [content] => Array ( [transactionID] => 189584034893843 [requestID] => 897439437848 [amount] => 2 [phone] => 0703xxxxxxxxxxx [serviceID] => mtn [email] => [email protected] [customerID] => [plan] => [image] => abtospay.com/uploads/XXXXXXXX.jpg [convinience_fee] => 0 [productType] => flexible [serviceName] => MTN Airtime VTU [status] => TRANSACTION_SUCCESSFUL [code] => 000 [description] => TRANSACTION_SUCCESSFUL [date] => 2019-03-22T11:16:05+01:00 ) [gateway] => Array ( [referrer] => abtospay.com/xxxxxxxx.html [host] => recharge.lajela.com [ip] => 185.2.168.39 ) )
This is actually useful after Payment, it helps to verify the status of payment, (if the payment was successfully or not due to unforeseen circumstance).
Use this link to verify testing payment https://abtospay.com/api/testverfy
$host = 'https://abtospay.com/api/verify'; $api = 'API KEY'; //Your API Key $data = array( 'requestID' => 8755965695964845 // For the transaction ); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $host, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_ENCODING => "", CURLOPT_POSTFIELDS => $data, 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", )); $response = curl_exec($curl); print_r(json_decode($response,true));
Array ( [code] => 402 [status] => TRANSACTION_FAILED [description] => INSUFFICIENT_BALANCE [content] => Array ( [transactionID] => 8585405894594 [requestID] => 3414793352 [amount] => 2 [phone] => 090xxxxxxxxxxx [serviceID] => gotv [email] => [email protected] [customerID] => 7017725579 [plan] => gotv-plus [image] => abtospay.com/images/products/200X200/Gotv-Payment.jpg [convinience_fee] => 100 [productType] => fix [serviceName] => Gotv Payment [status] => TRANSACTION_FAILED [code] => 016 [description] => INSUFFICIENT_BALANCE [date] => 2019-03-22T11:16:05+01:00 ) [gateway] => Array ( [referrer] => abtospay.com/xxxxxxxx.html [host] => recharge.lajela.com [ip] => 185.2.168.39 ) )
Get Your Available Balance.
$host = 'abtospay.com/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);
{ "response_description": "000", "content": { "balance": "841" } } }
Bellow 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'