{ "openapi": "3.0.1", "info": { "title": "Nkwa Pay API", "summary": "Use this API to integrate mobile money across your payment flows, create and manage payments, collections, and disbursements.", "description": "Read the docs at https://docs.mynkwa.com/api-reference", "license": { "name": "MIT" }, "version": "1.0.0" }, "servers": [ { "url": "https://api.pay.staging.mynkwa.com", "description": "Staging server" } ], "security": [ { "ApiKeyAuth": [] } ], "paths": { "/payments/{id}": { "get": { "description": "Get the payment (collection or disbursement) with the specified ID.", "parameters": [ { "name": "id", "in": "path", "description": "ID of payment to fetch", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Payment retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Payment" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } }, "404": { "description": "Payment not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } }, "500": { "description": "An error occurred", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } } } } }, "/collect": { "post": { "description": "Collect a payment from a phone number.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaymentRequest" } } } }, "responses": { "201": { "description": "Collection request created and pending", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Payment" } } } }, "400": { "description": "Invalid request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } }, "403": { "description": "Collection disabled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } }, "500": { "description": "An error occurred", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } } } } }, "/disburse": { "post": { "description": "Disburse a payment from your balance to a phone number.", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PaymentRequest" } } } }, "responses": { "201": { "description": "Disbursement request created and pending", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Payment" } } } }, "400": { "description": "Invalid request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } }, "403": { "description": "Disbursement disabled", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } }, "500": { "description": "An error occurred", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } } } } }, "/availability": { "get": { "description": "Check which operators and operations are currently available.", "responses": { "200": { "description": "Operator availability data", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Availability" } } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } }, "500": { "description": "An error occurred", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HttpError" } } } } } } } }, "components": { "schemas": { "Payment": { "type": "object", "properties": { "amount": { "type": "integer" }, "createdAt": { "type": "string", "format": "date-time" }, "currency": { "type": "string" }, "description": { "type": "string" }, "fee": { "type": "integer" }, "id": { "type": "string" }, "merchantId": { "type": "integer" }, "paymentType": { "$ref": "#/components/schemas/PaymentType" }, "phoneNumber": { "type": "string" }, "status": { "$ref": "#/components/schemas/PaymentStatus" }, "telecomOperator": { "$ref": "#/components/schemas/TelecomOperator" }, "updatedAt": { "type": "string", "format": "date-time" } } }, "PaymentRequest": { "type": "object", "required": ["amount", "phoneNumber"], "properties": { "amount": { "type": "integer" }, "phoneNumber": { "type": "string", "example": "237650000000" } } }, "HttpError": { "type": "object", "properties": { "details": { "type": "array", "items": {} }, "message": { "type": "string" }, "statusCode": { "type": "integer" } } }, "Availability": { "type": "object", "properties": { "operator": { "type": "string", "enum": ["mtn", "orange"] }, "operation": { "type": "object", "properties": { "type": { "type": "string", "enum": ["collection", "disbursement"] }, "status": { "type": "string", "enum": ["OPERATIONAL", "SUSPENDED"] } } } } }, "PaymentStatus": { "type": "string", "enum": ["pending", "success", "failed", "canceled"] }, "PaymentType": { "type": "string", "enum": ["collection", "disbursement"] }, "TelecomOperator": { "type": "string", "enum": ["mtn", "orange"] } }, "securitySchemes": { "ApiKeyAuth": { "type": "apiKey", "name": "X-API-Key", "in": "header" } } } }