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 Campaigns SMS - Get Groups SMS Initiate 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 VTU (Airtime & Data) Purchase Airtime Get Data Plans Purchase Data Plan Bill Payments (Electricity, Cable TV...) Verify Customer Buy Electricity Carrier Billing Run USSD Query Run Shortcode Query Query Status Carrier Callback Tools Create Sub-Account Check DND Status Check Service Status 3rd-party integrations ZOHO
VTU Data - Purchase This API allows you to purchase active data plans programmatically for any supported Nigerian mobile network.
POST
https://api.textng.xyz/vtu-purchase-data/
PHP code
<?php
 // Using cURL POST
  $key="YOUR-ACCOUNT-KEY";
  $network_provider="MTN, AIRTEL, GLO, 9MOBILE";
  $phone="SUBSCRIBER NUMBER";
  $plan_id="plan_id FROM Get Plans API";
  $response = httpPost("https://api.textng.xyz/vtu-purchase-data/",array("key"=>"$key","network_provider"=>"$network_provider","plan_id"=>"$plan_id","phone"=>$phone));
  // 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 Your developer API key. This authorizes every request and can be found on your Developer Dashboard.
network_provider * MTN The mobile network provider for the destination phone number. Example values: MTN, GLO, AIRTEL, 9MOBILE.
Phone * 08031234567 The phone number of the subscriber.
plan_id * 354408 The plan_id gotten from fetch data plans API.
Responses
Your transaction response will appear in JSON format as shown below.
Succesful query (JSON)
{
    "status": true,
    "message": "ORDER-COMPLETED",
    "data": {
        "reference":"9079946841763566241",
        "purchase_amount":"99",
        "amount_charged":99,
        "discount":0
    }
}
Error (JSON)
{
    "status": false,
    "message": "Unable to process order at this time",
    "reason": ""
}