{
  "openapi": "3.1.0",
  "info": {
    "title": "Payonetime Developers API",
    "version": "1.0.0",
    "description": "Sell airtime, data, electricity and TV.\n\n**Authentication:** `Authorization: Bearer sk_test_…`. Secret keys belong on your server only. Public keys can read the catalogue.\n\n**Money** is always a whole number of kobo.\n\n**Sale state:** `successful`, `failed`, `pending` or `reversed`. The outer `status` says the request was accepted; `state` says what happened to the money. **Pending is not failed:** do not send the sale again with a new reference. Wait for the webhook or call GET /transactions/{reference}.\n\n**HTTP codes for purchases:** 200 when final, 202 while pending.\n\n**Webhooks:** events `transaction.successful`, `transaction.failed`, `transaction.reversed`. Verify `X-Payonetime-Signature` = HMAC-SHA256(`X-Payonetime-Timestamp` + \".\" + raw body, your signing secret). Reject old timestamps; handle each `X-Payonetime-Event-Id` once. Failed deliveries are retried for about 24 hours.\n\n**Test mode:** the last four digits of the phone, meter or smartcard choose the result: 0001 fails, 0002 pending then succeeds, 0003 pending then fails, 0004 times out then succeeds, 0005 stays pending, 0009 meter or smartcard not found. Anything else succeeds.\n\n**Errors:** `INVALID_KEY` (401), `KEY_NOT_ALLOWED` (403), `IP_NOT_ALLOWED` (403), `ACCOUNT_NOT_ACTIVE` (403), `VALIDATION_FAILED` (422), `INVALID_PHONE` (422), `PLAN_UNAVAILABLE` (422), `METER_NOT_FOUND` (422), `SMARTCARD_NOT_FOUND` (422), `AMOUNT_OUT_OF_RANGE` (422), `INSUFFICIENT_BALANCE` (402), `REFERENCE_REUSED` (409), `DUPLICATE_PURCHASE` (409), `LIMIT_EXCEEDED` (403), `NUMBER_BLOCKED` (403), `SERVICE_UNAVAILABLE` (503), `NOT_FOUND` (404), `METHOD_NOT_ALLOWED` (405), `RATE_LIMITED` (429), `PROCESSING_ERROR` (500)."
  },
  "servers": [
    {
      "url": "https://api.developers.payonetime.ng/v1"
    }
  ],
  "paths": {
    "/ping": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "summary": "Ping",
        "description": "Check your key.",
        "operationId": "get_ping",
        "security": [
          {
            "secretKey": []
          },
          {
            "publicKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/services": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "summary": "Services",
        "description": "Services and whether each is available.",
        "operationId": "get_services",
        "security": [
          {
            "secretKey": []
          },
          {
            "publicKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/data/plans": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "summary": "Data plans",
        "description": "Data plans and prices. With a secret key, your commission too.",
        "operationId": "get_data_plans",
        "security": [
          {
            "secretKey": []
          },
          {
            "publicKey": []
          }
        ],
        "parameters": [
          {
            "name": "network",
            "in": "query",
            "required": false,
            "description": "mtn, airtel, glo or 9mobile",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "standard or saver",
            "schema": {
              "type": "string",
              "enum": [
                "standard",
                "saver"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/tv/packages": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "summary": "TV packages",
        "description": "TV packages and prices.",
        "operationId": "get_tv_packages",
        "security": [
          {
            "secretKey": []
          },
          {
            "publicKey": []
          }
        ],
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "description": "dstv, gotv or startimes",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/electricity/companies": {
      "get": {
        "tags": [
          "Catalogue"
        ],
        "summary": "Electricity companies",
        "description": "Electricity companies and limits.",
        "operationId": "get_electricity_companies",
        "security": [
          {
            "secretKey": []
          },
          {
            "publicKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/balance": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Balance",
        "description": "Main, commission and on-hold balances in kobo.",
        "operationId": "get_balance",
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/transactions": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Transactions",
        "description": "Your sales, newest first.",
        "operationId": "get_transactions",
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "pending, successful, failed or reversed",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "service",
            "in": "query",
            "required": false,
            "description": "airtime, data, electricity or tv",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1 to 100, default 20",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "next_cursor from the previous page",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start date, e.g. 2026-11-01",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End date",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/transactions/{reference}": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Transaction",
        "description": "The source of truth for one sale.",
        "operationId": "get_transactions_reference",
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/commissions": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Commissions",
        "description": "Commission you have earned.",
        "operationId": "get_commissions",
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1 to 100, default 20",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "next_cursor from the previous page",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start date, e.g. 2026-11-01",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End date",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/verify/meter": {
      "post": {
        "tags": [
          "Verify"
        ],
        "summary": "Verify meter",
        "description": "Name on an electricity meter.",
        "operationId": "post_verify_meter",
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "company",
                  "meter_type",
                  "meter"
                ],
                "properties": {
                  "company": {
                    "type": "string",
                    "description": "Company ID.",
                    "example": "ikeja"
                  },
                  "meter_type": {
                    "type": "string",
                    "description": "Meter type.",
                    "example": "prepaid",
                    "enum": [
                      "prepaid",
                      "postpaid"
                    ]
                  },
                  "meter": {
                    "type": "string",
                    "description": "Meter number. In test mode the last four digits choose the outcome.",
                    "example": "45012345678",
                    "pattern": "^[0-9]{6,20}$"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/verify/smartcard": {
      "post": {
        "tags": [
          "Verify"
        ],
        "summary": "Verify smartcard",
        "description": "Name on a TV smartcard.",
        "operationId": "post_verify_smartcard",
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "provider",
                  "smartcard"
                ],
                "properties": {
                  "provider": {
                    "type": "string",
                    "description": "TV provider.",
                    "example": "dstv"
                  },
                  "smartcard": {
                    "type": "string",
                    "description": "Smartcard number. In test mode the last four digits choose the outcome.",
                    "example": "7027000111",
                    "pattern": "^[0-9]{6,20}$"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/airtime": {
      "post": {
        "tags": [
          "Buy"
        ],
        "summary": "Airtime",
        "description": "Buy airtime.",
        "operationId": "post_airtime",
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "202": {
            "description": "Accepted and still pending"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "reference",
                  "network",
                  "phone",
                  "amount"
                ],
                "properties": {
                  "reference": {
                    "type": "string",
                    "description": "Your own unique ID for this sale (4 to 64 letters, numbers, . _ -). Sending it again returns the first result and never charges twice.",
                    "example": "order-10001",
                    "pattern": "^[A-Za-z0-9._-]{4,64}$"
                  },
                  "network": {
                    "type": "string",
                    "description": "Network.",
                    "example": "mtn",
                    "enum": [
                      "mtn",
                      "airtel",
                      "glo",
                      "9mobile"
                    ]
                  },
                  "phone": {
                    "type": "string",
                    "description": "Nigerian mobile number.",
                    "example": "08031234567"
                  },
                  "amount": {
                    "type": "integer",
                    "description": "Amount in kobo as a whole number (100000 is ₦1,000).",
                    "example": 100000,
                    "minimum": 1
                  },
                  "allow_duplicate": {
                    "type": "boolean",
                    "description": "Optional. Send true to buy the same number and amount again within the duplicate guard window (live only).",
                    "example": false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/data": {
      "post": {
        "tags": [
          "Buy"
        ],
        "summary": "Data",
        "description": "Buy a data plan. The plan decides whether it is Standard or Saver.",
        "operationId": "post_data",
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "202": {
            "description": "Accepted and still pending"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "reference",
                  "phone",
                  "plan_id"
                ],
                "properties": {
                  "reference": {
                    "type": "string",
                    "description": "Your own unique ID for this sale (4 to 64 letters, numbers, . _ -). Sending it again returns the first result and never charges twice.",
                    "example": "order-10001",
                    "pattern": "^[A-Za-z0-9._-]{4,64}$"
                  },
                  "phone": {
                    "type": "string",
                    "description": "Nigerian mobile number.",
                    "example": "08031234567"
                  },
                  "plan_id": {
                    "type": "string",
                    "description": "From GET /data/plans.",
                    "example": "dp_mtn_sv_1gb"
                  },
                  "allow_duplicate": {
                    "type": "boolean",
                    "description": "Optional. Send true to buy the same number and amount again within the duplicate guard window (live only).",
                    "example": false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/electricity": {
      "post": {
        "tags": [
          "Buy"
        ],
        "summary": "Electricity",
        "description": "Pay electricity. Prepaid returns a token.",
        "operationId": "post_electricity",
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "202": {
            "description": "Accepted and still pending"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "reference",
                  "company",
                  "meter_type",
                  "meter",
                  "amount",
                  "phone"
                ],
                "properties": {
                  "reference": {
                    "type": "string",
                    "description": "Your own unique ID for this sale (4 to 64 letters, numbers, . _ -). Sending it again returns the first result and never charges twice.",
                    "example": "order-10001",
                    "pattern": "^[A-Za-z0-9._-]{4,64}$"
                  },
                  "company": {
                    "type": "string",
                    "description": "Company ID.",
                    "example": "ikeja"
                  },
                  "meter_type": {
                    "type": "string",
                    "description": "Meter type.",
                    "example": "prepaid",
                    "enum": [
                      "prepaid",
                      "postpaid"
                    ]
                  },
                  "meter": {
                    "type": "string",
                    "description": "Meter number. In test mode the last four digits choose the outcome.",
                    "example": "45012345678",
                    "pattern": "^[0-9]{6,20}$"
                  },
                  "amount": {
                    "type": "integer",
                    "description": "Amount in kobo as a whole number (100000 is ₦1,000).",
                    "example": 500000,
                    "minimum": 1
                  },
                  "phone": {
                    "type": "string",
                    "description": "Nigerian mobile number.",
                    "example": "08031234567"
                  },
                  "allow_duplicate": {
                    "type": "boolean",
                    "description": "Optional. Send true to buy the same number and amount again within the duplicate guard window (live only).",
                    "example": false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/tv": {
      "post": {
        "tags": [
          "Buy"
        ],
        "summary": "TV",
        "description": "Renew a TV subscription.",
        "operationId": "post_tv",
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "success"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {}
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "202": {
            "description": "Accepted and still pending"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "reference",
                  "package_id",
                  "smartcard",
                  "phone"
                ],
                "properties": {
                  "reference": {
                    "type": "string",
                    "description": "Your own unique ID for this sale (4 to 64 letters, numbers, . _ -). Sending it again returns the first result and never charges twice.",
                    "example": "order-10001",
                    "pattern": "^[A-Za-z0-9._-]{4,64}$"
                  },
                  "package_id": {
                    "type": "string",
                    "description": "From GET /tv/packages.",
                    "example": "tv_dstv_compact"
                  },
                  "smartcard": {
                    "type": "string",
                    "description": "Smartcard number. In test mode the last four digits choose the outcome.",
                    "example": "7027000111",
                    "pattern": "^[0-9]{6,20}$"
                  },
                  "phone": {
                    "type": "string",
                    "description": "Nigerian mobile number.",
                    "example": "08031234567"
                  },
                  "allow_duplicate": {
                    "type": "boolean",
                    "description": "Optional. Send true to buy the same number and amount again within the duplicate guard window (live only).",
                    "example": false
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "secretKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "sk_test_… or sk_live_…"
      },
      "publicKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "pk_test_… (catalogue only)"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "status": {
            "const": "error"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "INVALID_KEY",
                  "KEY_NOT_ALLOWED",
                  "IP_NOT_ALLOWED",
                  "ACCOUNT_NOT_ACTIVE",
                  "VALIDATION_FAILED",
                  "INVALID_PHONE",
                  "PLAN_UNAVAILABLE",
                  "METER_NOT_FOUND",
                  "SMARTCARD_NOT_FOUND",
                  "AMOUNT_OUT_OF_RANGE",
                  "INSUFFICIENT_BALANCE",
                  "REFERENCE_REUSED",
                  "DUPLICATE_PURCHASE",
                  "LIMIT_EXCEEDED",
                  "NUMBER_BLOCKED",
                  "SERVICE_UNAVAILABLE",
                  "NOT_FOUND",
                  "METHOD_NOT_ALLOWED",
                  "RATE_LIMITED",
                  "PROCESSING_ERROR"
                ]
              },
              "message": {
                "type": "string"
              },
              "request_id": {
                "type": "string"
              },
              "fields": {
                "type": "object"
              }
            }
          }
        }
      }
    }
  }
}
