Skip to navigation

Purchase Utility Bill

View as Markdown

Pays a utility bill (e.g. electricity) for a previously verified meter. On success, data.token / data.unit carry the prepaid token, if applicable.

Body (JSON):

FieldTypeRules
idempotencyKeystringrequired, 4–250 chars
meterVerificationIdstringrequired; unused ID from Verify Entity for a Utility category
amountnumberrequired, ₦100–₦50,000
vendTypestringPREPAID or POSTPAID; required by the endpoint and must match the verified meter
settlementIdintegerrequired

The meter number comes from the verification. On SUCCESS, data.token is the prepaid token and data.unit the units (kWh) as returned by the provider (may be absent/null for postpaid). The duplicate response for this endpoint returns the full stored transaction record (different shape from the other purchase endpoints).

Purchase outcomes (shared flow):

  • 200 data.status: "SUCCESS" — delivered.
  • 200 data.status: "PENDING" with message ... purchase is being confirmed. Do not retry; check the transaction status. — provider outcome unknown; you have been debited and not refunded. Poll Fetch Single VTU Transaction; do not resend.
  • 400 ... purchase failed. Your balance has been refunded. — provider definitively rejected; safe to retry with a new idempotencyKey.
  • 409 Duplicate request in flight — another request with the same idempotencyKey is being processed.
  • 200 Duplicate request — returning existing transaction — the idempotencyKey was already used; the original transaction is returned and nothing is charged.

Your settlement balance must be strictly greater than the amount (balance <= amount is rejected as insufficient).

Error format: body validation failures (Joi) return { "status": "error", "message": "Validation error", "details": [ ... ] }; all other errors return { "success": false, "message": "..." }. Money fields (amount, fee) are Prisma Decimals and are serialized as strings (e.g. "1000").

Authentication

AuthorizationBearer

Access token from Generate Access Token (valid 15 minutes).

Request

This endpoint expects an object.
idempotencyKeystringOptional
meterVerificationIdstringOptional
settlementIdintegerOptional
amountintegerOptional
vendTypestringOptional

Response

Success / Pending (being confirmed) / Duplicate (existing transaction)

successbooleanOptional
dataobjectOptional
messagestringOptional

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
409
Conflict Error