Airtime PIN API

Version 2

Supports only (MTN,AIRTEL,9MOBILE AND GLO) Networks in Nigeria

This API allows you to generate airtime PIN directly from your wallet account.

You are required to enable Airtime/Data Api Token in settings page, save and then copy Api token generated.
Note: Do not share your Api Token



Use sha512 encryption algorithm to generate a hash from combining your Airtime Api Token, Account Email Address, Account Username and Your Transaction Reference.
$hash=hash('sha512', $token.$email.$username.$ref );
Note: The above example shows how to generate the hash in PHP, the dots are not part of the string but for concatenation
$Token is your Api Token
$Ref is an alphanumeric code generated by you for record purposes
Download PHP Sample files

To check account balance:
https://www.estoresms.com/smsapi.php?username=user123&password=pass123&balance=true&

where Account Username is user123 and account password is pass123

Note: Your username and password must be url encoded

RESPONSE CODES
 OK => Successful
 FAIL => Not Successful
 P000 => Incomplete Information
 P001 => Authentication failed
 P002 => Invalid Network selected
 P003 => Phone number is required
 P004 => Amount is required
 P005 => Amount is not numeric
 P006 => Minimum recharge allowed per transaction N1
 P007 => Invalid phone number
 P008 => Network selected for phone number is invalid
 P009 => Insufficient Balance
 P010 => API Token not enabled
 P011 => Process Failed
 P012 => Unable to complete request
 P013 => Maximum recharge allowed per transaction N300,000.
 P014 => Maximum number of pins that can be generated at once is 1000.



GET SUPPORTED NETWORKS
Url: https://estoresms.com/network_list
Method: GET
Parameters: None

SAMPLE RESPONSE
[
    {"id":"airtel","name":"Airtel Network"},
    {"id":"9mobile","name":"9mobile Network"},
    {"id":"mtn","name":"MTN Network"},
    {"id":"glo","name":"Glo Network"}
]


GENERATE AIRTIME PIN
Url: https://estoresms.com/network_processing/v/2
Method: POST
Request Format: JSON
Response Format: JSON
Specifying the network of the phone number is optional


SAMPLE REQUEST

Minimum Amount: 50
Maximum Amount: 300000
Note: Message limit is 20 characters
Count is the number of pins to generate (Optional, default is 1)
{
  "username":"user123",
  "ref":"MyRef001",
  "hash":"g521f5ba60d1fd56c0ee067bc838d4c6c502b7921ae530c4d2",
  "callback":"https://mywebsite/callback",
  "pinAmount":"50",
  "count":"2",
  "pinMessage":"Thank you for using our service",
}


SAMPLE RESPONSE 1
{
  "response":"OK",
  "ref":"myRef",
  "transaction_id":"api_5d2597bc3c287",
  "serial":"375919",
  "pin":"7069933456200",
  "USSD":"*258*7069933456200#",
  "amount":50,
  "amount_charged":49
}

{
   "response":"OK",
   "ref":"myRef",
   "transaction_id":"api_5d8cc87e9a396",
   "amount":2,
   "amount_charged":"1.96",
   "data":[
             {
                "serial":"3331167",
                "pin":"7018277106518",
                "USSD":"*258*7018277106518#"
             },
             {
                "serial":"3331168",
                "pin":"3711210133031",
                "USSD":"*258*3711210133031#"
             }
          ]
}





SAMPLE RESPONSE 3
{
    "response":"P009",
    "message":"Insufficient Balance"
}


QUERY TRANSACTION

Url: https://estoresms.com/api_query
Method: POST
Request Format: JSON
Response Format: JSON

SAMPLE REQUEST 1
{
   "username":"user123",
   "hash":"6a7ba624db21e84c6cb58e9e7f0055c8316bc2c2e3ac1d35e8c3fe",
   "transaction_id":"api_5ab5261c9b005"
}
            
SAMPLE REQUEST 2
{
   "username":"user123",
   "hash":"6a7ba624db21e84c6cb58e9e7f0055c8316bc2c2e3ac1d35e8c3fe",
   "ref":"myRef"
}
  

Transaction ID: This is the ID we generate by our system after each request has been processed
Ref: The Transaction Reference you generated while making airtime or data purchase
SAMPLE RESPONSE 1
{
   "response":"FAIL",
   "message":"No record found"
}


SAMPLE RESPONSE 2
[
    {
            "transaction_id":"api_5ab5261b9b029",
            "ref":"myRef",
            "category":"airtime",
            "network":"Everything Everywhere EE",
            "phone":"+1410xxxxxxx",
            "status":"Approved",
            "date":"2018-03-23 16:32:47",
            "topup_currency":"GBP",
            "topup_amount":"5",
            "price":"8389.26",
            "amount_charged":"8053.69"
    },
    {
            "transaction_id":"api_5ab2cf5a69f63",
            "ref":"myRef",
            "category":"data",
            "network":"MTN",
            "phone":"+234706*******",
            "status":"Approved",
            "date":"2018-01-23 10:56:50",
            "topup_currency":"NGN",
            "topup_amount":"100",
            "data_amount":"50",
            "price":"100",
            "amount_charged":"96"
    }
]
Status can be Approved, Pending, Failed, Awaiting Confirmation, Cancelled or Reversed


If callback is sent with request, a POST request would be sent once the status of the transaction changes to the following above. Sample details of POST request:

    [transaction_id] => api_5d1df2a313d00
    [reference] => myRef
    [status] => Approved