Vous êtes sur la page 1sur 4
10/04/2019 USSD API Simulator Tutorial USSD API Simulator Tutorial SvecesT EDITS ‘One of the important tasks you need to perform during your USSD application development is to test your application before deployment. We understand this and so, we have developed a simple USSD. ‘Simulator to help you achieve that It has features that allow you to simulate the interactions your USSD application will typically have with the Hubtel USSD gateway and a mobile phone user. Since you would be making USSD requests over the browser, itis advised that you set Cross Origin Request Sharing (CORS) headers in your application. Find sample examples below. You can read more on CORS here NB: Note that this is required just for testing. You are advised to remove the headers before going live for security reasons. cH Java PHP. //Needed for CORS implementation on PHP header("Access-control-Allow-origin: *"); header("Access-control-Allow-Methods: OPTIONS, GET, POST"); header('content-type: application/json; charset=utf-8"); header('content-type: application/json; charset=utf-8"); SussdRequest = json_decode(@file_get_contents(' php://input')) ; // Check if no errors occured. if (SussdRequest != NULL) { // Create a response object SussdResponse = new stdclass; // Set the message to display SussdResponse->Message "Hello world"; // Set the type of this response SussdResponse->Type = "Release"; // encode the response object as JSON and send echo json_encode(Sussdresponse) ; // €.9. SussdRequest->Message, //SussdRequest->Sessiontd, etc } hitps:/developers.hubtel.comvdocs/usse-ap:-simulator-tutrial wa 10/04/2019 USSD API Simulator Tutorial There are three major steps involved in using the Simulator 1. Step one: Set USSD routes. Setting the USSD routes requires you to select the various Mobile Network Operators you would be testing on. Simulator 1a. Add USSD Route foperster: servic Coa URL: ap apps eTsan comAISSOPIOn ClenCapas ad + Make a multiple selection of the available Mobile Network Operators. + Enter a test USSD Service Code Eg *714#. + Provide your USSD application URL. + Example URL: http://localhost/ussd-app/test php + Click on Add to add the selected routes for testing. 2. Step two: Make USSD requests. hitps:/developers.hubtel.comvdocs/usse-ap:-simulator-tutrial 214 10/04/2019 USSD API Simulator Tutorial 2. USSD Request Mobile: | 2us7isie7 operator |W 7 Message: THe Request pe: Neral Conant ype: © texan sepleateaon Tanout ins): | 0000 + Enter a test mobile number. Eg. 233541917372, + Select the Operator. + Enter your test USSD service code selected in 1a. In this case, *714#. + You can leave the rest in their default state, + Click on Send to make your initial request 3. Step three: View USSD requests and responses. 3. USSD Messages ‘har essoner seston ie sequence operator Cove MoBEe ype Massage crsesensetsoazaasTentoeTess2ns 2 uN 7 2SSSUITIBIST Response Welcome 1 Caps 2 ECHO: arstseescesnezeav remem 1 Pe) 2x6e718087 Innawon “78 ‘The USSD response that would be displayed as a menu on your mobile device would display in the Response textbox. Provide your response in the Message box and click on send again. Continue with the flow until the USSD session ends. hitps:/developers.hubtel.comvdocs/usse-ap:-simulator-tutrial 34

Vous aimerez peut-être aussi