Quick Start
Make your first API call in 5 minutes
Get up and running with the RizPay API in 5 minutes.
Prerequisites
- A RizPay business account
- API access enabled in your settings
- Your API key from Settings > API Keys
Using Postman? Download our Postman Collection to get started quickly with pre-configured requests.
Step 1: Get Your API Key
- Log in at my.rizpay.app
- Go to Settings > API Keys
- Click Create New Key
- Select scopes and environment
- Copy your secret key (shown only once!)
Your key looks like: sk_live_xxxxxxxxxxxx (production) or sk_test_xxxxxxxxxxxx (sandbox)
Warning: Never share your secret key or commit it to version control.
Step 2: Check Your Balance
Verify your API key works:
curl -X GET \
-H "Authorization: Bearer sk_live_your_secret_key" \
https://my.rizpay.app/api/partners/v1/account/balance
Response:
{
"status": { "code": 200, "message": "Success" },
"data": {
"balance": "50000.00",
"currency": "NGN",
"updated_at": "2024-01-15T10:30:00Z"
}
}
Step 3: List Products
See available airtime products:
curl -X GET \
-H "Authorization: Bearer sk_live_your_secret_key" \
"https://my.rizpay.app/api/partners/v1/products/airtimes?network=MTN"
Response:
{
"status": { "code": 200, "message": "Success" },
"data": [
{
"id": "prd_mtn_airtime",
"name": "MTN Airtime",
"type": "airtime",
"network": "MTN",
"min_amount": "50.00",
"max_amount": "50000.00",
"fee": "0.00"
}
]
}
Step 4: Make a Purchase
Purchase airtime:
curl -X POST \
-H "Authorization: Bearer sk_live_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"product_id": "prd_mtn_airtime",
"phone_number": "08012345678",
"amount": "100.00",
"external_reference": "1736234400A1B2C3"
}' \
https://my.rizpay.app/api/partners/v1/purchases
Response:
{
"status": { "code": 201, "message": "Purchase created" },
"data": {
"id": "txn_abc123",
"external_reference": "1736234400A1B2C3",
"amount": "100.00",
"fee": "0.00",
"total": "100.00",
"status": "pending",
"phone_number": "08012345678",
"created_at": "2024-01-15T10:35:00Z"
}
}
Tip: The
external_referencemust be exactly 16 characters: 10-digit Unix timestamp + 6 alphanumeric. See Duplicate Prevention for code examples.
Step 5: Check Status
Poll the transaction status:
curl -X GET \
-H "Authorization: Bearer sk_live_your_secret_key" \
https://my.rizpay.app/api/partners/v1/purchases/txn_abc123
Response (when complete):
{
"status": { "code": 200, "message": "Success" },
"data": {
"id": "txn_abc123",
"status": "successful",
"completed_at": "2024-01-15T10:35:02Z"
}
}
Simple Node.js Example
const API_KEY = "sk_live_your_secret_key";
const BASE_URL = "https://my.rizpay.app/api/partners/v1";
// 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 purchaseAirtime(phoneNumber, amount) {
const response = await fetch(`${BASE_URL}/purchases`, {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
product_id: "prd_mtn_airtime",
phone_number: phoneNumber,
amount: amount,
external_reference: generateReference(),
}),
});
return response.json();
}
// Usage
purchaseAirtime("08012345678", "500.00")
.then((result) => console.log(result))
.catch((error) => console.error(error));
Using the Sandbox
For testing, use sandbox credentials:
- Create a sandbox API key (
sk_test_*) - Use the sandbox endpoint:
/api/partners/sandbox/v1
curl -X GET \
-H "Authorization: Bearer sk_test_your_test_key" \
https://my.rizpay.app/api/partners/sandbox/v1/account/balance
Sandbox purchases don't charge your account or deliver real airtime.
Next Steps
- Authentication - Understand scopes and environments
- Error Handling - Handle errors gracefully
- Airtime Guide - Complete airtime integration
- Webhooks - Get real-time notifications
