Data Plans
Purchase mobile data bundles for all major networks
Buy daily, weekly, and monthly data bundles for MTN, Airtel, Glo, and 9mobile.
Supported Networks
| Network | Code |
|---|---|
| MTN Nigeria | MTN |
| Airtel Nigeria | AIRTEL |
| Globacom | GLO |
| 9mobile | 9MOBILE |
Bundle Types
| Type | Description |
|---|---|
daily | 24-hour validity |
weekly | 7-day validity |
monthly | 30-day validity |
Purchase Flow
Data plan purchases are straightforward - no verification required.
- List products - Get available data plans
- Make purchase - Send the purchase request
Step 1: List Products
Filter by network and/or bundle type:
bash
curl -X GET \
-H "Authorization: Bearer sk_live_your_secret_key" \
"https://my.rizpay.app/api/partners/v1/products/dataplans?network=MTN&bundle_type=monthly"
Response:
json
{
"status": { "code": 200, "message": "Success" },
"data": [
{
"id": "prd_mtn_1gb_monthly",
"name": "MTN 1GB Monthly",
"type": "data",
"network": "MTN",
"bundle_size": "1GB",
"bundle_type": "monthly",
"duration": "30 days",
"amount": "500.00",
"fee": "0.00"
},
{
"id": "prd_mtn_2gb_monthly",
"name": "MTN 2GB Monthly",
"type": "data",
"network": "MTN",
"bundle_size": "2GB",
"bundle_type": "monthly",
"duration": "30 days",
"amount": "1000.00",
"fee": "0.00"
},
{
"id": "prd_mtn_5gb_monthly",
"name": "MTN 5GB Monthly",
"type": "data",
"network": "MTN",
"bundle_size": "5GB",
"bundle_type": "monthly",
"duration": "30 days",
"amount": "2000.00",
"fee": "0.00"
}
],
"meta": {
"current_page": 1,
"per_page": 20,
"total_pages": 3,
"total_count": 45
}
}
Step 2: Make Purchase
bash
curl -X POST \
-H "Authorization: Bearer sk_live_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"product_id": "prd_mtn_2gb_monthly",
"phone_number": "08012345678",
"external_reference": "1736234400C3D4E5"
}' \
https://my.rizpay.app/api/partners/v1/purchases
Note: For data plans, the amount is fixed by the plan. You don't need to specify it.
Response:
json
{
"status": { "code": 201, "message": "Purchase created" },
"data": {
"id": "txn_abc123",
"reference": "data-order-001",
"product_id": "prd_mtn_2gb_monthly",
"amount": "1000.00",
"fee": "0.00",
"total": "1000.00",
"status": "pending",
"phone_number": "08012345678",
"created_at": "2024-01-15T10:30:00Z"
}
}
Check Transaction Status
bash
curl -X GET \
-H "Authorization: Bearer sk_live_your_secret_key" \
"https://my.rizpay.app/api/partners/v1/purchases/txn_abc123"
Successful response:
json
{
"status": { "code": 200, "message": "Success" },
"data": {
"id": "txn_abc123",
"reference": "data-order-001",
"status": "successful",
"amount": "1000.00",
"phone_number": "08012345678",
"bundle_size": "2GB",
"validity": "30 days",
"completed_at": "2024-01-15T10:30:03Z"
}
}
Complete Example
javascript
// Generate external reference: 10-digit timestamp + 6 alphanumeric
function generateReference() {
const timestamp = Math.floor(Date.now() / 1000);
const chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let suffix = "";
for (let i = 0; i < 6; i++) {
suffix += chars.charAt(Math.floor(Math.random() * chars.length));
}
return `${timestamp}${suffix}`;
}
async function purchaseDataPlan(network, bundleType, bundleSize, phoneNumber) {
const API_KEY = "sk_live_your_secret_key";
const BASE_URL = "https://my.rizpay.app/api/partners/v1";
// Step 1: Find matching data plans
const params = new URLSearchParams({
network: network,
bundle_type: bundleType,
});
const productsRes = await fetch(`${BASE_URL}/products/dataplans?${params}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
});
const products = await productsRes.json();
// Find the plan matching the requested bundle size
const product = products.data.find((p) => p.bundle_size === bundleSize);
if (!product) {
throw new Error(`No ${bundleSize} ${bundleType} plan found for ${network}`);
}
// Step 2: Make purchase
const purchaseRes = await fetch(`${BASE_URL}/purchases`, {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
product_id: product.id,
phone_number: phoneNumber,
external_reference: generateReference(),
}),
});
return await purchaseRes.json();
}
// Usage
purchaseDataPlan("MTN", "monthly", "2GB", "08012345678")
.then((result) => console.log(result))
.catch((error) => console.error(error));
Listing All Plans for a User
Build a plan selector by fetching all plans:
javascript
async function getDataPlans(network) {
const API_KEY = "sk_live_your_secret_key";
const BASE_URL = "https://my.rizpay.app/api/partners/v1";
const response = await fetch(
`${BASE_URL}/products/dataplans?network=${network}&per_page=100`,
{ headers: { Authorization: `Bearer ${API_KEY}` } }
);
const data = await response.json();
// Group by bundle type
const grouped = {
daily: [],
weekly: [],
monthly: [],
};
data.data.forEach((plan) => {
grouped[plan.bundle_type].push({
id: plan.id,
name: `${plan.bundle_size} - ₦${plan.amount}`,
size: plan.bundle_size,
price: plan.amount,
duration: plan.duration,
});
});
return grouped;
}
Popular Plans
MTN
| Plan | Price | Validity |
|---|---|---|
| 1GB | ~500 | 30 days |
| 2GB | ~1,000 | 30 days |
| 5GB | ~2,000 | 30 days |
| 10GB | ~3,500 | 30 days |
Airtel
| Plan | Price | Validity |
|---|---|---|
| 1GB | ~500 | 30 days |
| 2GB | ~1,000 | 30 days |
| 6GB | ~2,000 | 30 days |
Prices may vary. Always check the products endpoint for current pricing.
Transaction States
| Status | Description |
|---|---|
pending | Processing with provider |
successful | Data plan activated |
failed | Purchase failed (balance refunded) |
Required Scope
Requires the purchase_data scope on your API key.
Next Steps
- Airtime - Purchase airtime
- Electricity - Pay electricity bills
- Webhooks - Get notified when purchase completes
