Data Plans

LIVE
Endpoint

Send a GET request with query parameters to filter plans by provider and plan category.

Production URL
https://pairgate.com/api/v1/data-plans
Method GET
Test Endpoint
https://pairgate.com/api/v1/test/data-plans?provider_id=mtn&plan_type=CG
Authentication

This request requires a valid Bearer token.

Header Value Description
Authorization
Bearer {token}
Your unique API authorization token
Query Parameters

Both parameters are required. Include them in the URL query string.

Parameter Type Required Description
provider_id string Yes Provider slug (e.g. mtn, airtel, glo, 9mobile)
plan_type string Yes Plan category label: CG, CG_LITE, SME, GIFTING, AWOOF
Code Examples

Choose your preferred language below. Example shows fetching MTN SME data plans. Replace the parameters and YOUR_API_KEY with your actual values.

PHP (Laravel)
// Get Data Plans
$response = Http::withHeaders([
    'Authorization' => 'Bearer YOUR_API_KEY',
    'Cache-Control' => 'no-cache',
])->get('https://pairgate.com/api/v1/data-plans?provider_id=mtn&plan_type=SME');

$result = $response->json();

dd($result);
cURL
curl -X GET "https://pairgate.com/api/v1/data-plans?provider_id=mtn&plan_type=SME" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Cache-Control: no-cache"
Node.js
const axios = require('axios');

const getDataPlans = async (providerId, planType) => {
    try {
        const response = await axios.get(
            'https://pairgate.com/api/v1/data-plans',
            {
                params: {
                    provider_id: providerId,
                    plan_type: planType
                },
                headers: {
                    'Authorization': 'Bearer YOUR_API_KEY',
                    'Cache-Control': 'no-cache'
                }
            }
        );
        
        console.log(response.data);
    } catch (error) {
        console.error(error.response?.data || error.message);
    }
};

// Example: get MTN SME plans
getDataPlans('mtn', 'SME');
Python
import requests

url = "https://pairgate.com/api/v1/data-plans"

headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Cache-Control": "no-cache"
}

params = {
    "provider_id": "mtn",
    "plan_type": "SME"
}

try:
    response = requests.get(url, headers=headers, params=params)
    response.raise_for_status()
    data = response.json()
    print(data)
except requests.exceptions.RequestException as e:
    print(f"Error: {e}")
Java
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

HttpClient client = HttpClient.newHttpClient();

String url = "https://pairgate.com/api/v1/data-plans"
    + "?provider_id=" + URLEncoder.encode("mtn", StandardCharsets.UTF_8)
    + "&plan_type=" + URLEncoder.encode("SME", StandardCharsets.UTF_8);

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create(url))
    .header("Authorization", "Bearer YOUR_API_KEY")
    .header("Cache-Control", "no-cache")
    .GET()
    .build();

try {
    HttpResponse response = client.send(request, 
        HttpResponse.BodyHandlers.ofString());
    
    System.out.println(response.body());
} catch (Exception e) {
    System.err.println("Error: " + e.getMessage());
}
Response Format

A successful request returns a 200 status with plans grouped by provider name.

Success Response (200)
{
  "code": 200,
  "status": "success",
  "data": {
    "MTN": [
      {
        "plan_id": "45",
        "name": "MTN 1GB (AWOOF Special)",
        "price": 500.00,
        "duration": 30
      },
      {
        "plan_id": "46",
        "name": "MTN 2GB (Monthly)",
        "price": 900.00,
        "duration": 30
      },
      {
        "plan_id": "47",
        "name": "MTN 500MB (Weekly)",
        "price": 200.00,
        "duration": 7
      }
    ]
  }
}
Response Fields
Field Type Description
plan_id string Plan ID for use in purchase requests
name string Plan name (no duration information)
price float Plan cost in Naira (NGN)
duration integer Plan validity in days. 7 = 7 days (weekly), 30 = 30 days (monthly), 90 = 90 days (3 months), 365 = 365 days (yearly)
The name field no longer contains validity information. Use the duration field to display validity (e.g., "30 Days" badge next to plan name).
Error Responses

The following errors may occur when calling this endpoint.

Status Code Description
422 Invalid provider Provider not found or inactive
422 Invalid plan type Plan type label not recognised
401 Missing API key No Bearer token provided
401 Invalid API key Token does not match any active key
403 Suspended API key or account has been suspended
429 Rate limited Too many requests