Menu
Introduction Getting started SMS Promotional - Large campaigns Transactional - Basic Transactional (Alerts) - Virtual Number Route Transactional (Alerts) - Priority Routing Transactional (OTPs & Alerts) - Special route International route to Nigeria International route to Other Countries SMS DLR SMS DLR Webhooks Voice Voice OTP Voice Broadcasts Voice DLR Units Transfer Units to Sub-Account Transfer Units to Other Account Check Units Balance Sender IDs Register Sender IDs Check Sender ID status Categories Add Customer Remove Customer Virtual Number Inbox webhook Carrier Billing Run USSD Query Run Shortcode Query Query Status Tools Create Sub-Account Check DND Status Check Service Status 3rd-party integrations ZOHO
Run USSD Request The API is used when you want to programatically run a USSD query on your virtual number using the carrier billing service.
POST
https://api.textng.xyz/carrier_ussd/
PHP code
<?php
 // Using cURL POST
  $key="YOUR-ACCOUNT-KEY";
  $bypasscode="BYPASS CODE SERVER KEY";
  $ussd_query="USSD QUERY";
  $ussd_steps="1,2,4,2";
  $amount="AMOUNT";
  $push_pin="PIN";
  $response = httpPost("https://api.textng.xyz/carrier_ussd/",array("key"=>"$key","bypasscode"=>"$bypasscode","ussd"=>"$ussd_query","ussd_steps"=>"$ussd_steps","amt"=>"$amount","pin"=>"$push_pin"));
  // using php curl
  function httpPost($url, $data) {
      $curl = curl_init($url);
      curl_setopt($curl, CURLOPT_POST, true);
      curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      $response = curl_exec($curl);
      curl_close($curl);
      echo $response;
  }
?>
Parameters
Parameters Example Description
Key XXXXX-XXXX-XXXXX This can be found in the Developers page of your dashboard. The key authorizes the transaction.
Bypasscodes * XXXXXXXXXX This is to specify our carrier billing engine to use your unique bypass code. The code can be found at Carrier Billing Home under API code
USSD * *131# This is the ussd query you want to run on the specified bypass code for the carrier billing service
ussd_steps * 1 / 2 / This is are the other responses you want the USSD query to process when they are requested. e.g some USSD queries may require you to press 1 or 2 in other stages of the USSD sessions.

NOTE: Ensure to Seperate this with commas (,) and arrange in order of how it is to be used in the USSD stages (First Response, Second Response, to Last Response).
Amount * This is the amount of money received if you charged for the service. This is just to help you keep track of cash received if your vending on our service. Leave the value at "0" if you wish to ignore.
pin * XXXXX This is the push pin used to authorize the query to run on the carrier billing service
Responses
Your transaction response will appear in JSON format as shown below.
Succesful query (JSON)
{
    "D":{
    "details":[
        {
            "status":"successful",
            "ref_id":"REFERENCE_ID",
            "query":"USSD_QUERY_PUSHED",
            "type":"USSD"}
        ]
    }
}
Error - Bypass code authentication (JSON)
{
    "D":{
    "details":[
        {
        "status":"error-bypasscode-expired-or-not-exist"
        }]
    }
}
Error - Incorrect push pin (JSON)
{
    "D":{
        "details":[
        {
            "status":"incorrect-push-pin"
        }]
    }
}
Error - Invalid key (JSON)
{
    "D":{
        "details":[
            {
            "status":"error-key-invalid"
            }
        ]
    }
}