NEW APP AVAILABLE FOR DOWNLOAD NOW

Get it on Google PlayDownload on the App Store

Electricity

Pay electricity bills for all major distribution companies

Pay prepaid and postpaid electricity bills for all major Nigerian distribution companies.

Supported Distributors

CodeNameRegion
IKEDCIkeja ElectricLagos (Ikeja)
EKEDCEko ElectricLagos (Eko)
AEDCAbuja ElectricAbuja
KEDCKaduna ElectricKaduna
JEDCJos ElectricJos
IBEDCIbadan ElectricIbadan
KAEDCKano ElectricKano
EEDCEnugu ElectricEnugu
PhEDPort Harcourt ElectricPort Harcourt
BEDCBenin ElectricBenin
ABAAba PowerAba
YEDCYola ElectricYola

Purchase Flow

Electricity purchases require a two-step process:

  1. Verify - Validate the meter number and get customer details
  2. Purchase - Make the payment

This prevents payments to invalid meters.

Step 1: List Products

bash
curl -X GET \
  -H "Authorization: Bearer sk_live_your_secret_key" \
  "https://my.rizpay.app/api/partners/v1/products/electricity?distributor=IKEDC"

Response:

json
{
  "status": { "code": 200, "message": "Success" },
  "data": [
    {
      "id": "prd_ikedc_prepaid",
      "name": "IKEDC Prepaid",
      "type": "electricity",
      "distributor": "IKEDC",
      "meter_type": "prepaid",
      "min_amount": "500.00",
      "max_amount": "500000.00",
      "fee": "100.00"
    },
    {
      "id": "prd_ikedc_postpaid",
      "name": "IKEDC Postpaid",
      "type": "electricity",
      "distributor": "IKEDC",
      "meter_type": "postpaid",
      "min_amount": "500.00",
      "max_amount": "500000.00",
      "fee": "100.00"
    }
  ]
}

Step 2: Verify Meter

Required before purchase. Validates the meter and returns customer details.

bash
curl -X POST \
  -H "Authorization: Bearer sk_live_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "prd_ikedc_prepaid",
    "meter_number": "12345678901"
  }' \
  https://my.rizpay.app/api/partners/v1/purchases/verify

Response:

json
{
  "status": { "code": 200, "message": "Success" },
  "data": {
    "verified": true,
    "customer_name": "JOHN DOE",
    "customer_address": "123 Main Street, Ikeja, Lagos",
    "meter_type": "prepaid",
    "meter_number": "12345678901"
  }
}

Verification Errors

ErrorMeaning
VERIFICATION_FAILEDInvalid meter number
PRODUCT_UNAVAILABLEDistributor service is down

Step 3: Make Purchase

After verification, make the purchase:

bash
curl -X POST \
  -H "Authorization: Bearer sk_live_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "prd_ikedc_prepaid",
    "meter_number": "12345678901",
    "amount": "5000.00",
    "phone_number": "08012345678",
    "external_reference": "1736234400D4E5F6"
  }' \
  https://my.rizpay.app/api/partners/v1/purchases

Response:

json
{
  "status": { "code": 201, "message": "Purchase created" },
  "data": {
    "id": "txn_abc123",
    "reference": "elec-order-001",
    "product_id": "prd_ikedc_prepaid",
    "amount": "5000.00",
    "fee": "100.00",
    "total": "5100.00",
    "status": "pending",
    "meter_number": "12345678901",
    "created_at": "2024-01-15T10:30:00Z"
  }
}

Successful Purchase

When the transaction completes, the response includes the token:

json
{
  "status": { "code": 200, "message": "Success" },
  "data": {
    "id": "txn_abc123",
    "status": "successful",
    "token": "1234-5678-9012-3456-7890",
    "units": "45.5 kWh",
    "completed_at": "2024-01-15T10:30:05Z"
  }
}

Important: For prepaid meters, provide the token to the customer. They'll enter it into their meter to load the units.

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 payElectricity(meterNumber, amount, phoneNumber) {
  const API_KEY = "sk_live_your_secret_key";
  const BASE_URL = "https://my.rizpay.app/api/partners/v1";

  // Step 1: Find the product
  const productsRes = await fetch(
    `${BASE_URL}/products/electricity?distributor=IKEDC`,
    { headers: { Authorization: `Bearer ${API_KEY}` } }
  );
  const products = await productsRes.json();
  const product = products.data.find((p) => p.meter_type === "prepaid");

  // Step 2: Verify meter
  const verifyRes = await fetch(`${BASE_URL}/purchases/verify`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      product_id: product.id,
      meter_number: meterNumber,
    }),
  });

  const verification = await verifyRes.json();
  if (!verification.data.verified) {
    throw new Error("Invalid meter number");
  }

  // Step 3: 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,
      meter_number: meterNumber,
      amount: amount,
      phone_number: phoneNumber,
      external_reference: generateReference(),
    }),
  });

  return await purchaseRes.json();
}

Meter Types

TypeDescriptionToken
prepaidPay before useYes - customer enters token
postpaidPay after useNo - payment credits account

Required Scope

Requires the purchase_electricity scope on your API key.

Next Steps

  • Cable TV - Subscribe to cable TV
  • Webhooks - Get notified when payment completes