Airtime API
Our API is built to accept JSON requests.
JSON Request:
{ "username":"xxxxxx", "password":"xxxxxxxxxxxxxxxxxxxxxxxxxxxx", "mobile":"254721150817", "amount":"10", "client_ref":6325 }
Rules:
Follow this Request Instructions:
- Password: Encode using MD5 then the result encode using Base64.
- Endpoint: https://isms.
sms.kemrut.com/isms/api/ sendAirtime
Sample Code in PHP
< ?php function sendAirtime($mobile, $amount) { $username = "YOURUSERNAME"; $password = base64_encode(md5("YOURPASSWORD")); $client_ref = rand(1000, 9999); $airtime_data = array("username" => $username, "password" => $password, "mobile" => $mobile, "amount" => $amount, "client_ref" => $client_ref); $airtime_string = json_encode($airtime_data); $URL = "https://sms.kemrut.com/api/sendAirtime"; //POST $ch = curl_init($URL); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $airtime_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($airtime_string)) ); $apiresult = curl_exec($ch); echo("API Response: $apiresult\n"); if (!$apiresult) { die("ERROR on URL[$URL] | error[" . curl_error($ch) . "] | error code[" . curl_errno($ch) . "]\n"); } curl_close($ch); } ?>