CALLBACK (PUSH) - Receive Post Query Result

When you set up the callback URL, the result of each query is forwarded to the specified URL. The URL must be valid and return "200 OK" for every query to be valid. The inbox is sent as HTTPS POST JSON data.


PARAMETERS

Parameter Type Description
code integer The unique ID for the query
servername string The server name identifier as specified when setting up the server
refid string The custom reference id, if specified at the time of the query
ussd string The query that was submitted
reply string The reply sent by the network operator
 
 

SAMPLE JSON DATA


{
   "code":"2xxx",
   "servername":"MTN Server",
   "refid":"abcde01234",
   "ussd":"*556#",
   "reply":"Your balance is N28.08."
}
 
When the status of a submitted query is requested, the code parameter indicates the states of the transactions. The table below shows the mean of the code parameter.

 

Code Meaning Comment
2000 Pending The query is in the queue and yet to be processed
2001 Awaiting Reply (Running) The query has been processed but awaiting the feedback or confirmation reply from the operator
2002 Successful The query has been successfully submitted, the operator has given feedback, and the process was successful
2003 Failed The query has been successfully submitted, the operator has given feedback, and the response indicates that the process failed
2004 Unknown The query has been successfully submitted, but the system cannot the status of the query cannot be determined
 
 
 

Sample Code to Accept Data

Sample PHP code to retrieve the inbox data

<?php
    $data 
json_decode(file_get_contents('php://input'), true);
    
    
$code $data['code'];
    
$servername $data['servername'];
    
$refid $data['refid'];
    
$ussd $data['ussd'];
    
$reply $data['reply'];
    
    
//Do whatever you want to do with the data
 
?> 

 
Tags
Image

USSD on SIMHosting is a product of HoRLaR I.T. Solutions. It automates data and airtime vending via HTTPS POST/GET requests to the hosted SIM.