{
  "openapi": "3.1.0",
  "info": {
    "title": "ReadiesPay API",
    "version": "2026-04-24",
    "description": "ReadiesPay is a Nigerian payment gateway providing card, NIP (bank transfer),\nUSSD and QR rails under a single API. All monetary amounts are integer minor\nunits (kobo for NGN) \u2014 never floats.\n\n## Quickstart\n\n1. Create a merchant account and grab your sandbox keys from the portal at\n   <https://dashboard.readiespay.com>.\n2. Initialize your first payment:\n\n   ```bash\n   curl -X POST https://api.readiespay.com/api/v1/transactions/initialize \\\n     -H \"Authorization: Bearer sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxx\" \\\n     -H \"Content-Type: application/json\" \\\n     -H \"Idempotency-Key: $(uuidgen)\" \\\n     -d '{\n       \"amount_minor\": 150000,\n       \"currency\": \"NGN\",\n       \"rail\": \"card\",\n       \"customer_email\": \"buyer@example.com\",\n       \"callback_url\": \"https://merchant.example.com/payments/return\"\n     }'\n   ```\n\n3. Redirect your buyer to the `authorization_url` (card) or display the\n   `virtual_account` details (NIP). You'll receive a `charge.success` or\n   `charge.failed` webhook once the payment settles.\n\n## Two API surfaces\n\nThis document covers **both** surfaces served from the same base URL. Which one\nyou use depends on who is calling:\n\n- **Public API** \u2014 called by merchants' own backends using `sk_live_*` /\n  `sk_test_*` API keys. Tags: `Transactions`, `Transfers`, `Customers`, `Refunds`,\n  `Balance`, `Virtual Accounts`, `Settings`, `Fees`, `Webhooks`.\n- **Dashboard API** \u2014 called by the ReadiesPay merchant portal (dashboard.readiespay.com)\n  using short-lived Sanctum personal-access tokens obtained via `/auth/login`.\n  Tags prefixed `Dashboard -`.\n\n**Authentication \u2014 Public API.** `Authorization: Bearer sk_live_*` (production)\nor `sk_test_*` (sandbox). Public `pk_*` keys are restricted to client-side SDKs.\n\n**Authentication \u2014 Dashboard API.** `Authorization: Bearer <sanctum_pat>` obtained\nfrom `POST /auth/login`. Tokens do not expire server-side by default but are revoked\non `/auth/logout` and on password reset. Treat a `401` response as a signal to\nclear local state and redirect to login.\n\n**Idempotency.** Every mutating Public API endpoint accepts an `Idempotency-Key` header.\nSame key + same payload \u2192 same response. Same key + different payload \u2192 409.\n\n**Webhooks.** Outbound events carry `X-Readies-Signature: t=<unix_ts>,v1=<hex_hmac>`\n(HMAC-SHA512 of `\"${t}.${raw_body}\"` using your webhook secret) and\n`X-Readies-Event-Id` for merchant-side idempotency.\n\n**Rate limits.** Public API: 100 req/s per secret key. Dashboard auth endpoints:\n6 req/min per IP on `/auth/login` and `/auth/forgot-password`. `429` on breach with\n`Retry-After` header.\n\n**Error shape.** All errors share the `Error` schema (see components). Validation\nfailures (`422`) populate `details[]` with `{field, message}` entries.\n",
    "contact": {
      "name": "ReadiesPay Developer Support",
      "url": "https://docs.readiespay.com",
      "email": "developers@readiespay.com"
    },
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.readiespay.com/api/v1",
      "description": "Production"
    },
    {
      "url": "https://test-api.readiespay.com/api/v1",
      "description": "Sandbox"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Dashboard - Auth",
      "description": "Merchant-portal authentication. Signup is public; login issues a Sanctum\npersonal-access token that subsequent dashboard calls pass as\n`Authorization: Bearer <token>`.\n"
    },
    {
      "name": "Dashboard - Transactions",
      "description": "Merchant-portal views over the merchant's own transactions. Same underlying\ndata as the public `Transactions` endpoints, but scoped to the logged-in\nmerchant via Sanctum token. These endpoints also accept `sk_*` API keys\n(they're dual-auth) so integrations and the dashboard can share code.\n"
    },
    {
      "name": "Dashboard - Settings",
      "description": "Merchant business profile \u2014 the fields displayed on receipts, email\ntemplates, and the public support surface. Owner-only writes; non-owners\nsee the profile read-only. KYC tier and merchant status are surfaced\nhere for context but are **not** editable via these endpoints (they move\nvia the activation and KYC flows).\n"
    },
    {
      "name": "Dashboard - Settlements",
      "description": "Bank accounts where settlement money lands, plus reusable **split groups**\nthat let merchants route collections across multiple accounts. A group\ndeclares who bears the cost-of-transaction fee (COT): `account` (merchant),\n`subaccount` (a named settlement account), or `all` (prorated). A preview\nendpoint returns the exact breakdown without executing anything, so\nmerchants can validate config before attaching it to live traffic.\n"
    },
    {
      "name": "Dashboard - Webhooks",
      "description": "Manage the merchant's webhook endpoint from the portal. One URL per merchant\nin Phase 1. The signing secret is surfaced from the dashboard at any time so\nmerchants can recover it; rotation invalidates the old secret immediately.\n`POST /merchant/webhooks/test` synchronously delivers a sample\n`charge.success` event so you can debug receivers.\n"
    },
    {
      "name": "Dashboard - API Keys",
      "description": "Per-environment API key management. Publishable keys (`pk_*`) are safe to\nembed client-side and remain re-readable from the dashboard. Secret keys\n(`sk_*`) are only shown at issuance and after a rotation \u2014 losing them\nrequires rotation. Live keys are only issued once the merchant is moved\nto `live` status following `POST /merchant/keys/live/request`.\n"
    },
    {
      "name": "Dashboard - Team",
      "description": "Team management for the logged-in merchant. Owners can invite team members\n(`developer`, `support`, `viewer`) and disable them. Disabling is soft \u2014\nit sets `disabled_at`, revokes all of the target's Sanctum tokens, and\nprevents future logins. Deleting the last active owner is blocked.\n"
    },
    {
      "name": "Dashboard - KYC",
      "description": "Upload supporting documents and submit a KYC package so the merchant can\nbe promoted from `sandbox` to `live`. Phase 1 ships the `sole_prop`\n(sole-proprietor) flow, which requires a BVN plus three files:\n`government_id`, `utility_bill`, and `selfie`. Documents are uploaded\nindependently (multipart) and then referenced by id + storage path when\nthe submission is created. Submissions are immutable once created; a\nrejection that needs corrections flips the merchant back to `sandbox`\nso a fresh submission can be made.\n"
    },
    {
      "name": "Transactions",
      "description": "Initialize, verify, list payments across all rails"
    },
    {
      "name": "Virtual Accounts",
      "description": "NIP virtual account issuance and management"
    },
    {
      "name": "Transfers",
      "description": "Outbound NIP payouts to merchant or third-party NUBANs"
    },
    {
      "name": "Customers",
      "description": "Tokenized customer + card records for repeat charges"
    },
    {
      "name": "Refunds",
      "description": "Full or partial refunds on settled payments"
    },
    {
      "name": "Balance",
      "description": "Merchant balance (wallet, pending, reserve) and settlement history"
    },
    {
      "name": "Settings",
      "description": "Effective merchant settings (read + limited write)"
    },
    {
      "name": "Fees",
      "description": "Fee quoting"
    },
    {
      "name": "Webhooks",
      "description": "Webhook event inspection and test delivery"
    },
    {
      "name": "Sandbox",
      "description": "Sandbox-only endpoints for simulating customer payment outcomes. These\nare part of the deterministic mock collections layer \u2014 see\n`docs/SANDBOX_TESTING.md` for the full magic-input catalogue. Live keys\nare rejected with `503 LIVE_MODE_UNAVAILABLE`.\n"
    }
  ],
  "x-tagGroups": [
    {
      "name": "Public API",
      "tags": [
        "Transactions",
        "Virtual Accounts",
        "Transfers",
        "Customers",
        "Refunds",
        "Balance",
        "Webhooks",
        "Settings",
        "Fees",
        "Sandbox"
      ]
    },
    {
      "name": "Dashboard",
      "tags": [
        "Dashboard - Auth",
        "Dashboard - Transactions",
        "Dashboard - Settings",
        "Dashboard - Settlements",
        "Dashboard - Webhooks",
        "Dashboard - API Keys",
        "Dashboard - Team",
        "Dashboard - KYC"
      ]
    }
  ],
  "paths": {
    "/auth/signup": {
      "post": {
        "tags": [
          "Dashboard - Auth"
        ],
        "operationId": "signupMerchant",
        "summary": "Create a new merchant account",
        "description": "Creates a merchant record, a first `owner` user, and issues a pair of\nsandbox API keys (`pk_test_*` + `sk_test_*`) immediately. The `sk_test`\nkey is returned **once** in this response \u2014 surface it to the user and\nadvise them to copy it.\n\nNo authentication required. Email is normalised to lowercase and must be\nglobally unique.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignupRequest"
              },
              "examples": {
                "default": {
                  "value": {
                    "email": "jane@acmeltd.ng",
                    "password": "correct horse battery staple",
                    "accepted_tos": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Merchant created; sandbox keys issued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignupResponse"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/auth/login": {
      "post": {
        "tags": [
          "Dashboard - Auth"
        ],
        "operationId": "loginMerchantUser",
        "summary": "Log in a merchant user",
        "description": "Validates email+password and issues a Sanctum personal-access token.\nThe returned `token` has no server-side expiry by default; invalidate it\nvia `/auth/logout` or rotate by issuing a new one. Rate-limited to\n**6 requests per minute per IP**; excess requests return `429` with\n`Retry-After` seconds remaining.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              },
              "examples": {
                "default": {
                  "value": {
                    "email": "jane@acmeltd.ng",
                    "password": "correct horse battery staple"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Authentication succeeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResponse"
                }
              }
            }
          },
          "401": {
            "description": "Email or password incorrect",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "default": {
                    "value": {
                      "status": "error",
                      "code": "INVALID_CREDENTIALS",
                      "message": "The email or password is incorrect."
                    }
                  }
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/auth/logout": {
      "post": {
        "tags": [
          "Dashboard - Auth"
        ],
        "operationId": "logoutMerchantUser",
        "summary": "Revoke the current token",
        "description": "Deletes the Sanctum token used to make this request. Other tokens the\nuser holds (e.g. on another device) are unaffected. The client should\ndiscard the token locally after receiving a `200`.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Token revoked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          }
        }
      }
    },
    "/auth/forgot-password": {
      "post": {
        "tags": [
          "Dashboard - Auth"
        ],
        "operationId": "forgotPassword",
        "summary": "Send a password-reset email",
        "description": "Generates a single-use reset token valid for **60 minutes** and emails\nthe merchant user a link of the form\n`https://dashboard.readiespay.com/reset-password?token=<token>&email=<email>`.\n\n**Always returns `200`** regardless of whether the email matches a user,\nto prevent user enumeration. Rate-limited to 6 req/min per IP.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ForgotPasswordRequest"
              },
              "examples": {
                "default": {
                  "value": {
                    "email": "jane@acmeltd.ng"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reset email dispatched (if the address matches a user)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/auth/reset-password": {
      "post": {
        "tags": [
          "Dashboard - Auth"
        ],
        "operationId": "resetPassword",
        "summary": "Consume a reset token and set a new password",
        "description": "Exchanges a `(token, email)` pair \u2014 as delivered by `/auth/forgot-password` \u2014\nfor a password change. On success, **all existing Sanctum tokens for the\nuser are revoked** so any stolen sessions are invalidated; the client must\nlog in again.\n",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResetPasswordRequest"
              },
              "examples": {
                "default": {
                  "value": {
                    "email": "jane@acmeltd.ng",
                    "token": "a9c4f0\u2026",
                    "password": "my new secret phrase",
                    "password_confirmation": "my new secret phrase"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Password changed; client should redirect to /login",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid token, mismatched email, or weak password",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/merchant/profile": {
      "get": {
        "tags": [
          "Dashboard - Settings"
        ],
        "operationId": "getMerchantProfile",
        "summary": "Get the authenticated merchant's business profile",
        "description": "Returns every field on the merchant record the dashboard needs, plus an\n`editable_fields` hint enumerating which keys the caller may PATCH. Any\nauthenticated user can read.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Merchant profile",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MerchantProfile"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          }
        }
      },
      "patch": {
        "tags": [
          "Dashboard - Settings"
        ],
        "operationId": "updateMerchantProfile",
        "summary": "Update editable profile fields (owner-only)",
        "description": "Partial update \u2014 only the keys in the request body are touched. Unknown\nkeys and read-only keys (`status`, KYC tiers, timestamps) are silently\nignored. Invalid values return `422` with per-field details.\n\n**Organisational `type`** is self-service editable **only while\n`status = sandbox`**. Attempting to change it once the merchant has\nmoved to `under_review` or `live` returns `422` with code\n`VALIDATION_FAILED` and message \"Business type can only be changed\nwhile the account is in sandbox.\" The enum accepts `developer`,\n`sole_prop`, `ltd`, and `aggregator`; promotion to `mda` or `bank` is\nmanual and handled by ReadiesPay support.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MerchantProfileUpdate"
              },
              "examples": {
                "typical": {
                  "value": {
                    "business_name": "Acme Nigeria Ltd",
                    "industry_mcc": "5411",
                    "website": "https://acme.ng",
                    "support_email": "help@acme.ng",
                    "support_phone": "+2348031234567",
                    "expected_volume_band": "5m_50m"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated profile (full shape returned)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MerchantProfile"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/merchant/settlement-accounts": {
      "get": {
        "tags": [
          "Dashboard - Settlements"
        ],
        "operationId": "listSettlementAccounts",
        "summary": "List active settlement bank accounts for the merchant",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Settlement accounts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SettlementAccount"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Dashboard - Settlements"
        ],
        "operationId": "addSettlementAccount",
        "summary": "Add a settlement bank account",
        "description": "Owner-only. First account is auto-marked default. NUBAN name-enquiry is\nstubbed until NIBSS creds are wired; `verified_at` remains null.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettlementAccountCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Account created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SettlementAccount"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/merchant/settlement-accounts/{id}": {
      "delete": {
        "tags": [
          "Dashboard - Settlements"
        ],
        "operationId": "removeSettlementAccount",
        "summary": "Remove (soft-delete) a settlement account",
        "description": "Owner-only. Cannot remove the default while other accounts exist \u2014 promote another first.",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/merchant/split-groups": {
      "get": {
        "tags": [
          "Dashboard - Settlements"
        ],
        "operationId": "listSplitGroups",
        "summary": "List split groups for the merchant (with their entries)",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Split groups",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SplitGroup"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Dashboard - Settlements"
        ],
        "operationId": "createSplitGroup",
        "summary": "Create a split group",
        "description": "Owner-only. `entries` must reference settlement accounts owned by this merchant; percentage entries must sum to \u2264100%.",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SplitGroupInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SplitGroup"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/merchant/split-groups/{id}": {
      "patch": {
        "tags": [
          "Dashboard - Settlements"
        ],
        "operationId": "updateSplitGroup",
        "summary": "Replace a split group's configuration",
        "description": "Owner-only. Entries list is replaced atomically.",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SplitGroupInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SplitGroup"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      },
      "delete": {
        "tags": [
          "Dashboard - Settlements"
        ],
        "operationId": "deleteSplitGroup",
        "summary": "Delete a split group",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/merchant/split-groups/{id}/preview": {
      "post": {
        "tags": [
          "Dashboard - Settlements"
        ],
        "operationId": "previewSplitGroup",
        "summary": "Preview the breakdown for a given amount + fee",
        "description": "Runs the split calculator without persisting anything. Useful from the\nportal to confirm a configuration does what the merchant expects.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "amount_minor",
                  "fee_minor"
                ],
                "properties": {
                  "amount_minor": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "fee_minor": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Breakdown",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SplitBreakdown"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          }
        }
      }
    },
    "/merchant/webhooks": {
      "get": {
        "tags": [
          "Dashboard - Webhooks"
        ],
        "operationId": "listMerchantWebhooks",
        "summary": "Get the configured webhook (if any)",
        "description": "Returns an array with zero or one entry. When empty, the merchant has\nnot registered a webhook URL yet. The `signing_secret` is returned in\nplaintext so merchants can recover it; rotate via the rotate-secret\nendpoint if it leaks.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook config",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MerchantWebhook"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Dashboard - Webhooks"
        ],
        "operationId": "upsertMerchantWebhook",
        "summary": "Create or update the merchant's webhook URL",
        "description": "Owner-only. First call creates the webhook and generates a signing\nsecret. Subsequent calls only update the URL \u2014 the secret is preserved\n(rotate explicitly if you need a new one).\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "example": "https://merchantsite.com/webhooks/readies"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing webhook updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MerchantWebhook"
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Webhook created; includes the freshly generated signing secret",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MerchantWebhook"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/merchant/webhooks/test": {
      "post": {
        "tags": [
          "Dashboard - Webhooks"
        ],
        "operationId": "testMerchantWebhook",
        "summary": "Fire a test event to the configured URL",
        "description": "Synchronously POSTs a sample `charge.success` event (with real\nsignature + event-id headers) to the registered URL. Use this to debug\nthe merchant's receiver. Returns the HTTP status and latency of the\ndelivery. Owner-only.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery attempted \u2014 check `delivery.status` and `delivery.succeeded`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "delivery": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "integer",
                          "nullable": true,
                          "description": "HTTP status returned by the receiver, or null on connection failure"
                        },
                        "latency_ms": {
                          "type": "integer"
                        },
                        "event_id": {
                          "type": "string"
                        },
                        "body_excerpt": {
                          "type": "string",
                          "nullable": true,
                          "description": "First 500 bytes of the receiver's response body"
                        },
                        "error": {
                          "type": "string",
                          "nullable": true
                        },
                        "succeeded": {
                          "type": "boolean"
                        }
                      }
                    },
                    "webhook": {
                      "$ref": "#/components/schemas/MerchantWebhook"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/merchant/webhooks/{id}": {
      "delete": {
        "tags": [
          "Dashboard - Webhooks"
        ],
        "operationId": "deleteMerchantWebhook",
        "summary": "Remove the webhook config",
        "description": "Owner-only. After removal, future events are not delivered until a new URL is configured.",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SuccessResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/merchant/webhooks/{id}/rotate-secret": {
      "post": {
        "tags": [
          "Dashboard - Webhooks"
        ],
        "operationId": "rotateMerchantWebhookSecret",
        "summary": "Rotate the signing secret",
        "description": "Owner-only. The old secret stops working immediately \u2014 any receivers\nverifying signatures must update before the next delivery.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rotated \u2014 the new secret is in `data.signing_secret`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MerchantWebhook"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/merchant/keys/test": {
      "get": {
        "tags": [
          "Dashboard - API Keys"
        ],
        "operationId": "listTestKeys",
        "summary": "List sandbox (test-mode) keys for the authenticated merchant",
        "description": "Returns the live set of sandbox keys. Publishable keys are returned with\ntheir full plaintext (`key`). Secret keys are returned with `key: null`;\nrotate to obtain a new plaintext.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Key list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnvironmentKeys"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          }
        }
      }
    },
    "/merchant/keys/live": {
      "get": {
        "tags": [
          "Dashboard - API Keys"
        ],
        "operationId": "listLiveKeys",
        "summary": "List live-mode keys and activation state",
        "description": "For merchants that haven't requested live activation, `data` is empty\nand `activation.merchant_status` is `sandbox`. After\n`POST /merchant/keys/live/request`, status becomes `under_review`; once\na human review passes, status becomes `live` and live keys appear here.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Live keys + activation state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveKeysResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          }
        }
      }
    },
    "/merchant/keys/live/request": {
      "post": {
        "tags": [
          "Dashboard - API Keys"
        ],
        "operationId": "requestLiveActivation",
        "summary": "Request live activation for the merchant",
        "description": "Owner-only. Flips the merchant's status from `sandbox` to `under_review`\nand records the request timestamp. A human compliance review follows\nout of band; once approved, live keys are issued and the merchant can\naccept real money via `sk_live_*`.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "Activation requested",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "message": {
                      "type": "string"
                    },
                    "merchant": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "under_review"
                          ]
                        },
                        "live_activation_requested_at": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/merchant/keys/{id}/rotate": {
      "post": {
        "tags": [
          "Dashboard - API Keys"
        ],
        "operationId": "rotateApiKey",
        "summary": "Rotate (revoke + reissue) an API key",
        "description": "Owner-only. Revokes the key identified by `{id}` and issues a fresh one\nof the same environment + type, preserving the optional `name`. The\nresponse contains the new plaintext under `data.key` \u2014 save it now, it\nwill not be retrievable again (for secret keys).\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Key rotated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/IssuedApiKey"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/merchant/users": {
      "get": {
        "tags": [
          "Dashboard - Team"
        ],
        "operationId": "listMerchantUsers",
        "summary": "List team members for the authenticated merchant",
        "description": "Returns every user in the merchant org, including disabled ones. Any\nauthenticated user can view the team; only owners can modify it.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Team member list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MerchantUserSummary"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Dashboard - Team"
        ],
        "operationId": "inviteMerchantUser",
        "summary": "Invite a new team member",
        "description": "Creates a user row and emails an invitation link (reuses the\npassword-reset flow so the new user sets their own password).\nOwner-only.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InviteUserRequest"
              },
              "examples": {
                "default": {
                  "value": {
                    "name": "Devon Developer",
                    "email": "devon@acme.ng",
                    "role": "developer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "User created; invitation email dispatched",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MerchantUserSummary"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/merchant/users/{id}": {
      "delete": {
        "tags": [
          "Dashboard - Team"
        ],
        "operationId": "disableMerchantUser",
        "summary": "Disable a team member (soft delete)",
        "description": "Sets `disabled_at` on the target and revokes every Sanctum token they\nhold. A disabled user can no longer log in; their existing\nsessions terminate immediately. Owner-only.\n\nGuards:\n  - `422` if the actor tries to disable themselves\n  - `422` if the target is the last active owner\n  - `404` for a user not in the actor's merchant\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "User disabled",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MerchantUserSummary"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/merchant/kyc/documents": {
      "post": {
        "tags": [
          "Dashboard - KYC"
        ],
        "operationId": "uploadKycDocument",
        "summary": "Upload a KYC supporting document",
        "description": "Multipart upload of one document file plus a `kind` discriminator. The\nfile is hashed (SHA-256), stored under `kyc/{merchant_id}/\u2026`, and\nreturned with a `document_id` + `path` pair. Those two fields are\nwhat you later pass into `POST /merchant/kyc/submissions` \u2014 there is\nno \"attach now\" step; upload and submission are decoupled so the UI\ncan let users re-upload a single file without rebuilding the whole\npackage.\n\nMax file size: **8 MiB**. Accepted MIME types: `image/jpeg`,\n`image/png`, `image/webp`, `application/pdf`. Owner-only.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/KycDocumentUploadRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Document stored",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/KycDocumentUpload"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/merchant/kyc/submissions": {
      "get": {
        "tags": [
          "Dashboard - KYC"
        ],
        "operationId": "listKycSubmissions",
        "summary": "List the merchant's KYC submissions",
        "description": "Returns every submission the merchant has ever made, newest first.\nUseful for the portal's \"submission history\" view and for checking\nthe status of the active submission (the one with `reviewed_at: null`).\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Submission list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/KycSubmission"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "tags": [
          "Dashboard - KYC"
        ],
        "operationId": "submitKyc",
        "summary": "Submit a KYC package (sole proprietor)",
        "description": "Assembles previously-uploaded documents + a BVN into a reviewable\nsubmission. This is the step that flips the merchant from `sandbox`\ninto `under_review`.\n\n**Preconditions:**\n- Merchant `type = sole_prop`. LTD / BN / PLC / LLP / aggregator\n  merchants use `POST /merchant/kyc/submissions/ltd` instead.\n- Merchant `status = sandbox`.\n- No currently-open submission (`pending` or `under_review`).\n\n**BVN verification** runs inline against the configured\n`BvnVerifier` provider. A successful match populates\n`bvn_verified_at`; a mismatch does **not** block submission \u2014 it\nattaches a `bvn_mismatch` risk flag for the reviewer to act on.\n\nOwner-only.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KycSubmissionRequest"
              },
              "examples": {
                "sole_prop": {
                  "value": {
                    "bvn": "12345678901",
                    "documents": {
                      "government_id": {
                        "document_id": "b7b3f1a0-5e5b-4e2d-9a1e-4d7b2c4f1b9a",
                        "path": "kyc/42/b7b3f1a0-5e5b-4e2d-9a1e-4d7b2c4f1b9a_government_id.jpg"
                      },
                      "utility_bill": {
                        "document_id": "c91a45d6-a6c7-4aa9-8e30-0f2c0ae2f55b",
                        "path": "kyc/42/c91a45d6-a6c7-4aa9-8e30-0f2c0ae2f55b_utility_bill.pdf"
                      },
                      "selfie": {
                        "document_id": "d01aa60c-c9f2-4a2b-8b3d-7a93c2a8cf1b",
                        "path": "kyc/42/d01aa60c-c9f2-4a2b-8b3d-7a93c2a8cf1b_selfie.jpg"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Submission accepted; merchant moved to `under_review`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/KycSubmission"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/merchant/kyc/submissions/ltd": {
      "post": {
        "tags": [
          "Dashboard - KYC"
        ],
        "operationId": "submitKycLtd",
        "summary": "Submit a KYC package (LTD / BN / PLC / LLP / aggregator)",
        "description": "Submission shape for incorporated and aggregator merchants. Same\noutcome as the sole-prop endpoint \u2014 flips the merchant from `sandbox`\nto `under_review` \u2014 but the data shape is richer:\n\n- `cac_class` is one of `BN`, `LTD`, `PLC`, `LLP`. The class drives\n  which documents are required (MEMART is required for `LTD` / `PLC`\n  / `LLP`; `BN` skips it).\n- `directors[]` lists every director (LTD/PLC/LLP) or every owner\n  (BN). Each one's BVN is verified inline; mismatches attach a\n  per-director `bvn_mismatch` risk flag rather than blocking\n  submission.\n- Aggregator merchants (`merchant.type = aggregator`) must additionally\n  attach a signed `platform_agreement` document.\n\n**CAC verification** runs inline against the configured `CacVerifier`\nprovider. A successful match populates the submission's `rc_number` /\ncompany-name fields; a mismatch attaches a `cac_mismatch` risk flag.\n\nOwner-only.\n",
        "security": [
          {
            "dashboardAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KycLtdSubmissionRequest"
              },
              "examples": {
                "ltd": {
                  "value": {
                    "cac_class": "LTD",
                    "cac_number": "1234567",
                    "tin": "12345678",
                    "directors": [
                      {
                        "name": "Jane Doe",
                        "bvn": "12345678901"
                      },
                      {
                        "name": "John Smith",
                        "bvn": "22345678901"
                      }
                    ],
                    "documents": {
                      "cac_certificate": {
                        "document_id": "b7b3f1a0-5e5b-4e2d-9a1e-4d7b2c4f1b9a",
                        "path": "kyc/42/b7b3f1a0-5e5b-4e2d-9a1e-4d7b2c4f1b9a_cac_certificate.pdf"
                      },
                      "memart": {
                        "document_id": "c11a45d6-a6c7-4aa9-8e30-0f2c0ae2f55b",
                        "path": "kyc/42/c11a45d6-a6c7-4aa9-8e30-0f2c0ae2f55b_memart.pdf"
                      },
                      "bank_statement": {
                        "document_id": "d22aa60c-c9f2-4a2b-8b3d-7a93c2a8cf1b",
                        "path": "kyc/42/d22aa60c-c9f2-4a2b-8b3d-7a93c2a8cf1b_bank_statement.pdf"
                      },
                      "utility_bill": {
                        "document_id": "e33aa60c-c9f2-4a2b-8b3d-7a93c2a8cf1b",
                        "path": "kyc/42/e33aa60c-c9f2-4a2b-8b3d-7a93c2a8cf1b_utility_bill.pdf"
                      }
                    }
                  }
                },
                "bn": {
                  "summary": "Business Name (no MEMART)",
                  "value": {
                    "cac_class": "BN",
                    "cac_number": "9876543",
                    "directors": [
                      {
                        "name": "Jane Doe",
                        "bvn": "12345678901"
                      }
                    ],
                    "documents": {
                      "cac_certificate": {
                        "document_id": "f44b3f1a-5e5b-4e2d-9a1e-4d7b2c4f1b9a",
                        "path": "kyc/42/f44b3f1a-5e5b-4e2d-9a1e-4d7b2c4f1b9a_cac_certificate.pdf"
                      },
                      "bank_statement": {
                        "document_id": "5577a60c-c9f2-4a2b-8b3d-7a93c2a8cf1b",
                        "path": "kyc/42/5577a60c-c9f2-4a2b-8b3d-7a93c2a8cf1b_bank_statement.pdf"
                      },
                      "utility_bill": {
                        "document_id": "6688a60c-c9f2-4a2b-8b3d-7a93c2a8cf1b",
                        "path": "kyc/42/6688a60c-c9f2-4a2b-8b3d-7a93c2a8cf1b_utility_bill.pdf"
                      }
                    }
                  }
                },
                "aggregator": {
                  "summary": "Aggregator (LTD + platform agreement)",
                  "value": {
                    "cac_class": "LTD",
                    "cac_number": "1234567",
                    "directors": [
                      {
                        "name": "Jane Doe",
                        "bvn": "12345678901"
                      }
                    ],
                    "documents": {
                      "cac_certificate": {
                        "document_id": "b7b3f1a0-5e5b-4e2d-9a1e-4d7b2c4f1b9a",
                        "path": "kyc/42/cac.pdf"
                      },
                      "memart": {
                        "document_id": "c11a45d6-a6c7-4aa9-8e30-0f2c0ae2f55b",
                        "path": "kyc/42/memart.pdf"
                      },
                      "bank_statement": {
                        "document_id": "d22aa60c-c9f2-4a2b-8b3d-7a93c2a8cf1b",
                        "path": "kyc/42/bank.pdf"
                      },
                      "utility_bill": {
                        "document_id": "e33aa60c-c9f2-4a2b-8b3d-7a93c2a8cf1b",
                        "path": "kyc/42/util.pdf"
                      },
                      "platform_agreement": {
                        "document_id": "7799a60c-c9f2-4a2b-8b3d-7a93c2a8cf1b",
                        "path": "kyc/42/7799a60c-c9f2-4a2b-8b3d-7a93c2a8cf1b_platform_agreement.pdf"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Submission accepted; merchant moved to `under_review`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/KycSubmission"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/transactions/initialize": {
      "post": {
        "tags": [
          "Transactions"
        ],
        "operationId": "initializeTransaction",
        "summary": "Initialize a payment",
        "description": "Creates a pending payment and returns either an `authorization_url`\n(hosted card flow) or a `virtual_account` (NIP flow).\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InitializeRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Payment initialized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InitializeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "409": {
            "$ref": "#/components/responses/IdempotencyConflict"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          },
          "503": {
            "$ref": "#/components/responses/LiveModeUnavailable"
          }
        },
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST https://api.readiespay.com/api/v1/transactions/initialize \\\n  -H \"Authorization: Bearer sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxx\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: $(uuidgen)\" \\\n  -d '{\n    \"amount_minor\": 150000,\n    \"currency\": \"NGN\",\n    \"rail\": \"card\",\n    \"customer_email\": \"buyer@example.com\",\n    \"customer_name\": \"Aisha Bello\",\n    \"callback_url\": \"https://merchant.example.com/payments/return\"\n  }'\n"
          },
          {
            "lang": "javascript",
            "label": "Node.js",
            "source": "import { randomUUID } from \"node:crypto\";\n\nconst res = await fetch(\"https://api.readiespay.com/api/v1/transactions/initialize\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.READIES_SECRET_KEY}`,\n    \"Content-Type\": \"application/json\",\n    \"Idempotency-Key\": randomUUID(),\n  },\n  body: JSON.stringify({\n    amount_minor: 150000,\n    currency: \"NGN\",\n    rail: \"card\",\n    customer_email: \"buyer@example.com\",\n    customer_name: \"Aisha Bello\",\n    callback_url: \"https://merchant.example.com/payments/return\",\n  }),\n});\nconst payment = await res.json();\n// redirect buyer to payment.authorization_url\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os, uuid, requests\n\nres = requests.post(\n    \"https://api.readiespay.com/api/v1/transactions/initialize\",\n    headers={\n        \"Authorization\": f\"Bearer {os.environ['READIES_SECRET_KEY']}\",\n        \"Idempotency-Key\": str(uuid.uuid4()),\n    },\n    json={\n        \"amount_minor\": 150000,\n        \"currency\": \"NGN\",\n        \"rail\": \"card\",\n        \"customer_email\": \"buyer@example.com\",\n        \"customer_name\": \"Aisha Bello\",\n        \"callback_url\": \"https://merchant.example.com/payments/return\",\n    },\n    timeout=15,\n)\nres.raise_for_status()\npayment = res.json()\n# redirect buyer to payment[\"authorization_url\"]\n"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.readiespay.com/api/v1/transactions/initialize');\ncurl_setopt_array($ch, [\n    CURLOPT_POST => true,\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_HTTPHEADER => [\n        'Authorization: Bearer ' . getenv('READIES_SECRET_KEY'),\n        'Content-Type: application/json',\n        'Idempotency-Key: ' . bin2hex(random_bytes(16)),\n    ],\n    CURLOPT_POSTFIELDS => json_encode([\n        'amount_minor' => 150000,\n        'currency' => 'NGN',\n        'rail' => 'card',\n        'customer_email' => 'buyer@example.com',\n        'customer_name' => 'Aisha Bello',\n        'callback_url' => 'https://merchant.example.com/payments/return',\n    ]),\n]);\n$payment = json_decode(curl_exec($ch), true);\n// redirect buyer to $payment['authorization_url']\n"
          },
          {
            "lang": "go",
            "label": "Go",
            "source": "package main\n\nimport (\n    \"bytes\"\n    \"encoding/json\"\n    \"net/http\"\n    \"os\"\n\n    \"github.com/google/uuid\"\n)\n\nfunc initialize() (*http.Response, error) {\n    body, _ := json.Marshal(map[string]any{\n        \"amount_minor\":   150000,\n        \"currency\":       \"NGN\",\n        \"rail\":           \"card\",\n        \"customer_email\": \"buyer@example.com\",\n        \"customer_name\":  \"Aisha Bello\",\n        \"callback_url\":   \"https://merchant.example.com/payments/return\",\n    })\n\n    req, _ := http.NewRequest(\"POST\",\n        \"https://api.readiespay.com/api/v1/transactions/initialize\",\n        bytes.NewReader(body))\n    req.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"READIES_SECRET_KEY\"))\n    req.Header.Set(\"Content-Type\", \"application/json\")\n    req.Header.Set(\"Idempotency-Key\", uuid.NewString())\n    return http.DefaultClient.Do(req)\n}\n"
          }
        ]
      }
    },
    "/transactions/{reference}": {
      "get": {
        "tags": [
          "Transactions",
          "Dashboard - Transactions"
        ],
        "operationId": "getTransaction",
        "summary": "Fetch a single transaction",
        "description": "Dual-auth: accepts a public-API key (`sk_live_*` / `sk_test_*`) OR a\ndashboard Sanctum token. Transactions are always scoped to the\nauthenticated merchant; foreign references return 404.\n",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "dashboardAuth": []
          }
        ],
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Transaction wrapped under `data`",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Transaction"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/sandbox/checkout/{reference}": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "operationId": "sandboxSubmitCard",
        "summary": "Submit a card PAN against a pending sandbox card charge",
        "description": "Customer-facing endpoint hit from the page at the `authorization_url`\nreturned by `POST /transactions/initialize` (with `rail=card`). Use\nmagic test PANs to deterministically simulate outcomes. See\n`docs/SANDBOX_TESTING.md` for the catalogue. No authentication \u2014\nthe customer's browser hits this directly.\n",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "pan",
                  "expiry",
                  "cvv"
                ],
                "properties": {
                  "pan": {
                    "type": "string",
                    "example": "4084 0840 8408 4081"
                  },
                  "expiry": {
                    "type": "string",
                    "example": "12/30"
                  },
                  "cvv": {
                    "type": "string",
                    "example": "123"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Outcome of the simulated card submission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reference": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "failed"
                      ]
                    },
                    "otp_required": {
                      "type": "boolean"
                    },
                    "error_code": {
                      "type": "string",
                      "nullable": true
                    },
                    "message": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "This sandbox checkout session has already been completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/checkout/{reference}/otp": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "operationId": "sandboxSubmitOtp",
        "summary": "Submit an OTP for a pending sandbox card charge that requested it",
        "description": "Use OTP `123456` to simulate success. Any other value simulates an\ninvalid-OTP failure. No authentication \u2014 customer browser endpoint.\n",
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "otp"
                ],
                "properties": {
                  "otp": {
                    "type": "string",
                    "example": "123456"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Outcome of the simulated OTP submission",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reference": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "failed"
                      ]
                    },
                    "error_code": {
                      "type": "string",
                      "nullable": true
                    },
                    "message": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "This sandbox checkout session has already been completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/transactions/{reference}/settle": {
      "post": {
        "tags": [
          "Sandbox"
        ],
        "operationId": "sandboxForceSettle",
        "summary": "Synchronously settle a pending sandbox charge",
        "description": "Useful for CI environments where running a queue worker for the\ndelayed webhook isn't practical. Flips the transaction to its\nplanned terminal state and dispatches the webhook in-process. Idempotent\non already-terminal charges.\n",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The (now-terminal) transaction",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reference": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "success",
                        "failed"
                      ]
                    },
                    "error_code": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "503": {
            "$ref": "#/components/responses/LiveModeUnavailable"
          }
        }
      }
    },
    "/transactions": {
      "get": {
        "tags": [
          "Transactions",
          "Dashboard - Transactions"
        ],
        "operationId": "listTransactions",
        "summary": "List the merchant's transactions (paginated, filterable)",
        "description": "Returns transactions for the authenticated merchant, newest first.\nDual-auth: accepts `sk_*` keys OR a dashboard Sanctum token. Pagination\nis page-based for the dashboard flow.\n",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "dashboardAuth": []
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Filter by transaction status",
            "schema": {
              "$ref": "#/components/schemas/TransactionStatus"
            }
          },
          {
            "name": "rail",
            "in": "query",
            "description": "Filter by settlement rail",
            "schema": {
              "$ref": "#/components/schemas/Rail"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "description": "Alias for `rail` \u2014 accepted so legacy/PDF clients work",
            "schema": {
              "$ref": "#/components/schemas/Rail"
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Prefix match on the transaction reference",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "customer_email",
            "in": "query",
            "description": "Exact match on customer email (case-insensitive)",
            "schema": {
              "type": "string",
              "format": "email"
            }
          },
          {
            "name": "date_from",
            "in": "query",
            "description": "Inclusive lower bound on `created_at`",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "date_to",
            "in": "query",
            "description": "Inclusive upper bound on `created_at`",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated transactions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedTransactions"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/DashboardUnauthorized"
          },
          "422": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/charges": {
      "post": {
        "tags": [
          "Transactions"
        ],
        "operationId": "chargeToken",
        "summary": "Charge a saved card token (returning customer)",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChargeTokenRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Charge accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transaction"
                }
              }
            }
          },
          "402": {
            "description": "Card declined",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/refunds": {
      "post": {
        "tags": [
          "Refunds"
        ],
        "operationId": "createRefund",
        "summary": "Create a refund",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefundRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Refund queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Refund"
                }
              }
            }
          }
        }
      }
    },
    "/virtual-accounts": {
      "post": {
        "tags": [
          "Virtual Accounts"
        ],
        "operationId": "issueVirtualAccount",
        "summary": "Issue a virtual NUBAN",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VirtualAccountRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Virtual account issued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualAccount"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Virtual Accounts"
        ],
        "operationId": "listVirtualAccounts",
        "summary": "List virtual accounts",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "expired",
                "closed"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedVirtualAccounts"
                }
              }
            }
          }
        }
      }
    },
    "/virtual-accounts/{nuban}": {
      "get": {
        "tags": [
          "Virtual Accounts"
        ],
        "operationId": "getVirtualAccount",
        "summary": "Get a virtual account",
        "parameters": [
          {
            "name": "nuban",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9]{10}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Virtual account",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VirtualAccount"
                }
              }
            }
          }
        }
      }
    },
    "/transfers": {
      "post": {
        "tags": [
          "Transfers"
        ],
        "operationId": "initiateTransfer",
        "summary": "Initiate a NIP payout",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransferRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Transfer accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transfer"
                }
              }
            }
          }
        }
      }
    },
    "/transfers/{id}": {
      "get": {
        "tags": [
          "Transfers"
        ],
        "operationId": "getTransfer",
        "summary": "Get transfer status",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Transfer details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Transfer"
                }
              }
            }
          }
        }
      }
    },
    "/transfers/recipient-verify": {
      "post": {
        "tags": [
          "Transfers"
        ],
        "operationId": "verifyRecipient",
        "summary": "NUBAN name-enquiry before transfer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "nuban",
                  "bank_code"
                ],
                "properties": {
                  "nuban": {
                    "type": "string",
                    "pattern": "^[0-9]{10}$"
                  },
                  "bank_code": {
                    "type": "string",
                    "pattern": "^[0-9]{3,6}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resolved account name",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "account_name": {
                      "type": "string"
                    },
                    "kyc_level": {
                      "type": "string",
                      "enum": [
                        "tier1",
                        "tier2",
                        "tier3"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/customers": {
      "post": {
        "tags": [
          "Customers"
        ],
        "operationId": "createCustomer",
        "summary": "Create a customer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Customer created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}": {
      "get": {
        "tags": [
          "Customers"
        ],
        "operationId": "getCustomer",
        "summary": "Get a customer",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}/cards": {
      "get": {
        "tags": [
          "Customers"
        ],
        "operationId": "listCustomerCards",
        "summary": "List saved cards (tokenized)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cards",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Card"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/balance": {
      "get": {
        "tags": [
          "Balance"
        ],
        "operationId": "getBalance",
        "summary": "Get merchant balance (wallet, pending, reserve)",
        "responses": {
          "200": {
            "description": "Balance breakdown",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl https://api.readiespay.com/api/v1/balance \\\n  -H \"Authorization: Bearer sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxx\"\n"
          },
          {
            "lang": "javascript",
            "label": "Node.js",
            "source": "const res = await fetch(\"https://api.readiespay.com/api/v1/balance\", {\n  headers: { Authorization: `Bearer ${process.env.READIES_SECRET_KEY}` },\n});\nconst balance = await res.json();\n"
          },
          {
            "lang": "python",
            "label": "Python",
            "source": "import os, requests\n\nres = requests.get(\n    \"https://api.readiespay.com/api/v1/balance\",\n    headers={\"Authorization\": f\"Bearer {os.environ['READIES_SECRET_KEY']}\"},\n    timeout=15,\n)\nbalance = res.json()\n"
          },
          {
            "lang": "php",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init('https://api.readiespay.com/api/v1/balance');\ncurl_setopt_array($ch, [\n    CURLOPT_RETURNTRANSFER => true,\n    CURLOPT_HTTPHEADER => [\n        'Authorization: Bearer ' . getenv('READIES_SECRET_KEY'),\n    ],\n]);\n$balance = json_decode(curl_exec($ch), true);\n"
          },
          {
            "lang": "go",
            "label": "Go",
            "source": "package main\n\nimport (\n    \"encoding/json\"\n    \"net/http\"\n    \"os\"\n)\n\nfunc fetchBalance() (map[string]any, error) {\n    req, _ := http.NewRequest(\"GET\", \"https://api.readiespay.com/api/v1/balance\", nil)\n    req.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"READIES_SECRET_KEY\"))\n    res, err := http.DefaultClient.Do(req)\n    if err != nil {\n        return nil, err\n    }\n    defer res.Body.Close()\n    var out map[string]any\n    return out, json.NewDecoder(res.Body).Decode(&out)\n}\n"
          }
        ]
      }
    },
    "/settlements": {
      "get": {
        "tags": [
          "Balance"
        ],
        "operationId": "listSettlements",
        "summary": "List settlement batches",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated settlements",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedSettlements"
                }
              }
            }
          }
        }
      }
    },
    "/settlements/{id}": {
      "get": {
        "tags": [
          "Balance"
        ],
        "operationId": "getSettlement",
        "summary": "Get settlement batch detail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Settlement batch",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Settlement"
                }
              }
            }
          }
        }
      }
    },
    "/fees/quote": {
      "post": {
        "tags": [
          "Fees"
        ],
        "operationId": "quoteFee",
        "summary": "Preview fee for a given amount + rail",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "amount_minor",
                  "currency",
                  "rail"
                ],
                "properties": {
                  "amount_minor": {
                    "type": "integer",
                    "format": "int64"
                  },
                  "currency": {
                    "type": "string",
                    "example": "NGN"
                  },
                  "rail": {
                    "$ref": "#/components/schemas/Rail"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Fee quote",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeeQuote"
                }
              }
            }
          }
        }
      }
    },
    "/settings": {
      "get": {
        "tags": [
          "Settings"
        ],
        "operationId": "getEffectiveSettings",
        "summary": "Get the merchant's effective settings",
        "responses": {
          "200": {
            "description": "Effective settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectiveSettings"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Settings"
        ],
        "operationId": "updateMerchantSettings",
        "summary": "Update merchant-overrideable settings",
        "description": "Only the keys listed in `EffectiveSettings.overrideable_keys` are accepted.\nUnknown keys \u2192 422.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectiveSettings"
                }
              }
            }
          }
        }
      }
    },
    "/webhook-events": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "listWebhookEvents",
        "summary": "List recent webhook events delivered (or attempted) to this merchant",
        "parameters": [
          {
            "name": "event",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook events",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedWebhookEvents"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks/test": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "fireTestWebhook",
        "summary": "Fire a test webhook to the merchant's registered URL",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "event"
                ],
                "properties": {
                  "event": {
                    "type": "string",
                    "enum": [
                      "charge.success",
                      "charge.failed",
                      "charge.pending",
                      "transfer.success",
                      "transfer.failed",
                      "refund.processed",
                      "virtual_account.credit",
                      "dispute.opened"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Test event queued"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Public-API key. `sk_live_*` (production) or `sk_test_*` (sandbox).\nPublic `pk_*` keys have read-only / tokenization-only scope.\n"
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "in": "header",
        "name": "Idempotency-Key",
        "schema": {
          "type": "string",
          "maxLength": 128
        },
        "required": false,
        "description": "Unique key (recommended: UUID) so retries don't double-post.\nSame key + same payload \u2192 cached prior response.\nSame key + different payload \u2192 409 IDEMPOTENCY_KEY_MISUSE.\n"
      },
      "Cursor": {
        "in": "query",
        "name": "cursor",
        "schema": {
          "type": "string"
        },
        "description": "Opaque pagination cursor from a previous response's `next_cursor`"
      }
    },
    "schemas": {
      "SignupRequest": {
        "type": "object",
        "required": [
          "email",
          "password",
          "accepted_tos"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "description": "Will be normalised to lowercase and checked for global uniqueness"
          },
          "password": {
            "type": "string",
            "format": "password",
            "minLength": 12,
            "description": "Minimum 12 characters. Not subject to composition rules."
          },
          "accepted_tos": {
            "type": "boolean",
            "description": "Must be `true`. Records the ToS acceptance timestamp."
          }
        }
      },
      "SignupResponse": {
        "type": "object",
        "required": [
          "status",
          "merchant",
          "user",
          "api_keys"
        ],
        "properties": {
          "status": {
            "type": "string",
            "example": "ok"
          },
          "merchant": {
            "$ref": "#/components/schemas/DashboardMerchant"
          },
          "user": {
            "$ref": "#/components/schemas/DashboardUser"
          },
          "api_keys": {
            "type": "array",
            "description": "A `pk_test_*` and a `sk_test_*` key. The `sk_test_*` key's plaintext is returned **only here** \u2014 store it now.",
            "items": {
              "$ref": "#/components/schemas/IssuedApiKey"
            }
          }
        }
      },
      "LoginRequest": {
        "type": "object",
        "required": [
          "email",
          "password"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "password": {
            "type": "string",
            "format": "password"
          }
        }
      },
      "LoginResponse": {
        "type": "object",
        "required": [
          "token",
          "user",
          "merchant"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "Opaque Sanctum personal-access token. Attach as `Authorization: Bearer <token>`.",
            "example": "42|xGqOZ7lV4p8s0aM2kc8yW3N1rR5h6Bf9dJ"
          },
          "user": {
            "$ref": "#/components/schemas/DashboardUser"
          },
          "merchant": {
            "$ref": "#/components/schemas/DashboardMerchant"
          }
        }
      },
      "ForgotPasswordRequest": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          }
        }
      },
      "ResetPasswordRequest": {
        "type": "object",
        "required": [
          "email",
          "token",
          "password",
          "password_confirmation"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "token": {
            "type": "string",
            "description": "Reset token as delivered via email. Single-use; 60-minute lifetime."
          },
          "password": {
            "type": "string",
            "format": "password",
            "minLength": 12
          },
          "password_confirmation": {
            "type": "string",
            "format": "password",
            "description": "Must match `password`."
          }
        }
      },
      "DashboardUser": {
        "type": "object",
        "required": [
          "id",
          "email",
          "role"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "example": 1
          },
          "name": {
            "type": "string",
            "nullable": true,
            "example": "Jane Okafor"
          },
          "email": {
            "type": "string",
            "format": "email",
            "example": "jane@acmeltd.ng"
          },
          "role": {
            "type": "string",
            "description": "Role within the merchant organisation. Currently always `owner`; additional values arrive with the Users & Roles module.",
            "enum": [
              "owner",
              "developer",
              "support",
              "viewer"
            ],
            "example": "owner"
          },
          "email_verified_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "DashboardMerchant": {
        "type": "object",
        "required": [
          "id",
          "type",
          "status"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "example": 1,
            "description": "Auto-increment primary key"
          },
          "type": {
            "type": "string",
            "enum": [
              "developer",
              "sole_prop",
              "ltd",
              "mda",
              "aggregator",
              "bank"
            ],
            "description": "Organisational profile. A merchant can be promoted across types without signing up again."
          },
          "status": {
            "type": "string",
            "enum": [
              "sandbox",
              "under_review",
              "live",
              "suspended",
              "closed"
            ],
            "description": "Lifecycle state. `sandbox` issues test keys only; `live` issues live keys after KYC."
          },
          "business_name": {
            "type": "string",
            "nullable": true,
            "example": "Acme Ltd"
          },
          "kyc_tier_current": {
            "type": "string",
            "enum": [
              "tier1",
              "tier2",
              "tier3"
            ],
            "example": "tier1"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "IssuedApiKey": {
        "type": "object",
        "required": [
          "id",
          "environment",
          "type",
          "prefix",
          "last_four"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "description": "Database ID of the key record"
          },
          "environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "live"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "publishable",
              "secret"
            ],
            "description": "`publishable` = `pk_*`, safe to embed in client-side code. `secret` = `sk_*`, server-side only."
          },
          "key": {
            "type": "string",
            "nullable": true,
            "description": "Plaintext key. Returned **only** at initial issuance; omitted on subsequent reads.",
            "example": "sk_test_01hwxy0123456789abcdefghjk"
          },
          "prefix": {
            "type": "string",
            "example": "sk_test",
            "description": "Prefix identifying environment + type, e.g. `pk_test`, `sk_live`."
          },
          "last_four": {
            "type": "string",
            "example": "hjk",
            "description": "Last four characters of the key. Use this to help users identify a key without seeing its plaintext."
          }
        }
      },
      "SuccessResponse": {
        "type": "object",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string",
            "example": "ok"
          },
          "message": {
            "type": "string",
            "example": "Password updated."
          }
        }
      },
      "MerchantProfile": {
        "type": "object",
        "required": [
          "id",
          "type",
          "status"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "type": {
            "type": "string",
            "enum": [
              "developer",
              "sole_prop",
              "ltd",
              "mda",
              "aggregator",
              "bank"
            ],
            "description": "Organisational profile. Self-service `PATCH /merchant/profile` may\nset it to `developer | sole_prop | ltd | aggregator` while the\nmerchant is in `sandbox`; `mda` and `bank` are assigned manually\nby support.\n"
          },
          "status": {
            "type": "string",
            "enum": [
              "sandbox",
              "under_review",
              "live",
              "suspended",
              "closed"
            ]
          },
          "business_name": {
            "type": "string",
            "nullable": true,
            "example": "Acme Nigeria Ltd"
          },
          "industry_mcc": {
            "type": "string",
            "nullable": true,
            "description": "4-digit merchant category code (ISO 18245).",
            "example": "5411"
          },
          "website": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "example": "https://acme.ng"
          },
          "support_email": {
            "type": "string",
            "format": "email",
            "nullable": true,
            "example": "help@acme.ng"
          },
          "support_phone": {
            "type": "string",
            "nullable": true,
            "description": "E.164 format, e.g. `+2348031234567`."
          },
          "expected_volume_band": {
            "type": "string",
            "nullable": true,
            "enum": [
              "lt_5m",
              "5m_50m",
              "50m_500m",
              "gt_500m"
            ],
            "description": "Self-declared monthly volume bucket. Used for fee-schedule selection and risk tiering."
          },
          "kyc_tier_current": {
            "type": "string",
            "enum": [
              "tier1",
              "tier2",
              "tier3"
            ]
          },
          "kyc_tier_target": {
            "type": "string",
            "enum": [
              "tier1",
              "tier2",
              "tier3"
            ]
          },
          "live_activation_requested_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "editable_fields": {
            "type": "array",
            "description": "Which keys `PATCH /merchant/profile` will accept. Everything else is ignored silently.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "MerchantProfileUpdate": {
        "type": "object",
        "description": "All fields optional; only keys in the body are touched.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "developer",
              "sole_prop",
              "ltd",
              "aggregator"
            ],
            "description": "Business type. Mutable **only** while `status = sandbox`. Attempting\nto change once the merchant has moved to `under_review` or `live`\nreturns `422`. Promotion to `mda` / `bank` is handled manually by\nsupport and is not exposed here.\n"
          },
          "business_name": {
            "type": "string",
            "maxLength": 255,
            "nullable": true
          },
          "industry_mcc": {
            "type": "string",
            "nullable": true,
            "pattern": "^[0-9]{4}$"
          },
          "website": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "Must be HTTPS."
          },
          "support_email": {
            "type": "string",
            "format": "email",
            "nullable": true
          },
          "support_phone": {
            "type": "string",
            "nullable": true,
            "pattern": "^\\+?[1-9][0-9]{1,14}$"
          },
          "expected_volume_band": {
            "type": "string",
            "nullable": true,
            "enum": [
              "lt_5m",
              "5m_50m",
              "50m_500m",
              "gt_500m"
            ]
          }
        }
      },
      "SettlementAccount": {
        "type": "object",
        "required": [
          "id",
          "nuban",
          "bank_code",
          "is_default",
          "is_active"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "nuban": {
            "type": "string",
            "pattern": "^[0-9]{10}$",
            "example": "0123456789"
          },
          "bank_code": {
            "type": "string",
            "example": "057"
          },
          "bank_name": {
            "type": "string",
            "nullable": true,
            "example": "Zenith Bank"
          },
          "account_name": {
            "type": "string",
            "description": "Account holder name. Currently supplied by the merchant until NIBSS name-enquiry is wired."
          },
          "label": {
            "type": "string",
            "nullable": true,
            "description": "Merchant-chosen nickname for this account"
          },
          "is_default": {
            "type": "boolean"
          },
          "is_active": {
            "type": "boolean"
          },
          "verified_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Populated after successful NIBSS name-enquiry (currently always null \u2014 stub in place)"
          },
          "verified_via": {
            "type": "string",
            "nullable": true,
            "enum": [
              "nibss_name_enquiry"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SettlementAccountCreate": {
        "type": "object",
        "required": [
          "nuban",
          "bank_code"
        ],
        "properties": {
          "nuban": {
            "type": "string",
            "pattern": "^[0-9]{10}$"
          },
          "bank_code": {
            "type": "string",
            "pattern": "^[0-9]{3,6}$"
          },
          "bank_name": {
            "type": "string"
          },
          "account_name": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "is_default": {
            "type": "boolean"
          }
        }
      },
      "SplitEntry": {
        "type": "object",
        "required": [
          "subaccount_id",
          "mode",
          "value"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "subaccount_id": {
            "type": "integer",
            "description": "ID of a SettlementAccount owned by this merchant"
          },
          "mode": {
            "type": "string",
            "enum": [
              "percentage",
              "flat"
            ],
            "description": "`percentage`: `value` is basis points (10000 = 100%). `flat`: `value` is minor units (kobo)."
          },
          "value": {
            "type": "integer",
            "minimum": 1
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "sort_order": {
            "type": "integer"
          }
        }
      },
      "SplitEntryInput": {
        "type": "object",
        "required": [
          "subaccount_id",
          "mode",
          "value"
        ],
        "properties": {
          "subaccount_id": {
            "type": "integer"
          },
          "mode": {
            "type": "string",
            "enum": [
              "percentage",
              "flat"
            ]
          },
          "value": {
            "type": "integer",
            "minimum": 1
          },
          "label": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "SplitGroup": {
        "type": "object",
        "required": [
          "id",
          "name",
          "bearer_type",
          "entries"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string",
            "example": "Marketplace 70/30"
          },
          "currency": {
            "type": "string",
            "example": "NGN"
          },
          "bearer_type": {
            "type": "string",
            "enum": [
              "account",
              "subaccount",
              "all"
            ],
            "description": "Who bears the processing fee (COT)"
          },
          "bearer_subaccount_id": {
            "type": "integer",
            "nullable": true,
            "description": "Required when bearer_type=subaccount"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SplitEntry"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SplitGroupInput": {
        "type": "object",
        "required": [
          "name",
          "bearer_type",
          "entries"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 128
          },
          "currency": {
            "type": "string",
            "example": "NGN"
          },
          "bearer_type": {
            "type": "string",
            "enum": [
              "account",
              "subaccount",
              "all"
            ]
          },
          "bearer_subaccount_id": {
            "type": "integer",
            "nullable": true
          },
          "entries": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/SplitEntryInput"
            }
          }
        }
      },
      "SplitBreakdownLine": {
        "type": "object",
        "properties": {
          "subaccount_id": {
            "type": "integer"
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "mode": {
            "type": "string",
            "enum": [
              "percentage",
              "flat"
            ]
          },
          "value": {
            "type": "integer"
          },
          "raw_minor": {
            "type": "integer",
            "description": "Pre-fee share in minor units"
          },
          "fee_borne_minor": {
            "type": "integer",
            "description": "How much fee this entry absorbed (only non-zero when bearer is `all` or `subaccount` and this entry is the target)"
          },
          "net_minor": {
            "type": "integer",
            "description": "Amount this recipient actually receives"
          }
        }
      },
      "SplitBreakdown": {
        "type": "object",
        "properties": {
          "gross_minor": {
            "type": "integer"
          },
          "fee_minor": {
            "type": "integer"
          },
          "bearer_type": {
            "type": "string",
            "enum": [
              "account",
              "subaccount",
              "all"
            ]
          },
          "merchant": {
            "type": "object",
            "properties": {
              "gross_minor": {
                "type": "integer",
                "description": "What remains after splits"
              },
              "fee_borne_minor": {
                "type": "integer",
                "description": "Fee the merchant absorbs (residual after the bearer policy)"
              },
              "net_minor": {
                "type": "integer",
                "description": "Final merchant take-home"
              }
            }
          },
          "subaccount_payout_minor": {
            "type": "integer",
            "description": "Sum of what all subaccount recipients get"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SplitBreakdownLine"
            }
          }
        }
      },
      "MerchantWebhook": {
        "type": "object",
        "required": [
          "id",
          "url",
          "signing_secret"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://merchantsite.com/webhooks/readies"
          },
          "signing_secret": {
            "type": "string",
            "description": "Plaintext secret used to verify incoming events. Prefix `whsec_`.\nMerchants hold a copy; we also keep it so the dashboard can reveal\nit. Rotate if you suspect compromise.\n",
            "example": "whsec_01HWXY0123456789ABCDEFGHJKabcdefghjkmnpqrstuvwx"
          },
          "last_delivered_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "last_response_status": {
            "type": "integer",
            "nullable": true,
            "description": "HTTP status from the receiver on the most recent delivery attempt. Null if no delivery has been attempted or the request couldn't connect."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "StoredApiKey": {
        "type": "object",
        "required": [
          "id",
          "environment",
          "type",
          "prefix",
          "last_four"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "environment": {
            "type": "string",
            "enum": [
              "sandbox",
              "live"
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "publishable",
              "secret"
            ]
          },
          "key": {
            "type": "string",
            "nullable": true,
            "description": "Full plaintext for publishable keys; always `null` for secret keys in list views. Rotate to obtain a new secret plaintext."
          },
          "prefix": {
            "type": "string",
            "example": "pk_test_aBcD"
          },
          "last_four": {
            "type": "string",
            "example": "wxyz"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "last_used_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EnvironmentKeys": {
        "type": "object",
        "required": [
          "environment",
          "data"
        ],
        "properties": {
          "environment": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StoredApiKey"
            }
          }
        }
      },
      "LiveKeysResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EnvironmentKeys"
          },
          {
            "type": "object",
            "required": [
              "activation"
            ],
            "properties": {
              "activation": {
                "type": "object",
                "properties": {
                  "merchant_status": {
                    "type": "string",
                    "enum": [
                      "sandbox",
                      "under_review",
                      "live",
                      "suspended",
                      "closed"
                    ]
                  },
                  "requested_at": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true
                  }
                }
              }
            }
          }
        ]
      },
      "MerchantUserSummary": {
        "type": "object",
        "required": [
          "id",
          "email",
          "role"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "example": 2
          },
          "name": {
            "type": "string",
            "nullable": true,
            "example": "Devon Developer"
          },
          "email": {
            "type": "string",
            "format": "email",
            "example": "devon@acme.ng"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "developer",
              "support",
              "viewer"
            ]
          },
          "disabled_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When non-null the user can no longer log in. Revoking is soft \u2014 future admin tooling may re-enable."
          },
          "email_verified_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "InviteUserRequest": {
        "type": "object",
        "required": [
          "name",
          "email",
          "role"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 255
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 255
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "developer",
              "support",
              "viewer"
            ]
          }
        }
      },
      "Rail": {
        "type": "string",
        "enum": [
          "nip",
          "card",
          "ussd",
          "qr"
        ]
      },
      "TransactionStatus": {
        "type": "string",
        "enum": [
          "pending",
          "success",
          "failed",
          "reversed"
        ]
      },
      "Money": {
        "type": "object",
        "required": [
          "amount_minor",
          "currency"
        ],
        "properties": {
          "amount_minor": {
            "type": "integer",
            "format": "int64",
            "description": "Amount in minor units (kobo for NGN)",
            "example": 1000000
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217",
            "example": "NGN"
          }
        }
      },
      "InitializeRequest": {
        "type": "object",
        "required": [
          "amount_minor",
          "currency",
          "customer_email",
          "rail"
        ],
        "properties": {
          "amount_minor": {
            "type": "integer",
            "format": "int64",
            "minimum": 1
          },
          "currency": {
            "type": "string",
            "example": "NGN"
          },
          "rail": {
            "$ref": "#/components/schemas/Rail"
          },
          "customer_email": {
            "type": "string",
            "format": "email"
          },
          "customer_name": {
            "type": "string"
          },
          "customer_phone": {
            "type": "string"
          },
          "reference_suffix": {
            "type": "string",
            "description": "Optional merchant-side suffix appended to the generated reference"
          },
          "callback_url": {
            "type": "string",
            "format": "uri",
            "description": "Where to redirect after a hosted card flow"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "InitializeResponse": {
        "type": "object",
        "required": [
          "reference",
          "status",
          "rail"
        ],
        "properties": {
          "reference": {
            "type": "string",
            "example": "01HWXY0123456789ABCDEFGHJK"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending"
            ]
          },
          "rail": {
            "$ref": "#/components/schemas/Rail"
          },
          "authorization_url": {
            "type": "string",
            "format": "uri",
            "description": "Present when `rail=card`"
          },
          "virtual_account": {
            "description": "Present when `rail=nip`",
            "$ref": "#/components/schemas/VirtualAccount"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ChargeTokenRequest": {
        "type": "object",
        "required": [
          "card_token",
          "amount_minor",
          "currency",
          "customer_id"
        ],
        "properties": {
          "card_token": {
            "type": "string"
          },
          "amount_minor": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string"
          },
          "customer_id": {
            "type": "string"
          },
          "cvv": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "Transaction": {
        "type": "object",
        "required": [
          "reference",
          "type",
          "status",
          "gross",
          "fee",
          "net",
          "created_at"
        ],
        "properties": {
          "reference": {
            "type": "string",
            "example": "01HWXY0123456789ABCDEFGHJK"
          },
          "type": {
            "type": "string",
            "enum": [
              "payment",
              "payout",
              "refund",
              "chargeback",
              "fee",
              "reversal",
              "fx",
              "adjustment",
              "reserve_release"
            ]
          },
          "status": {
            "$ref": "#/components/schemas/TransactionStatus"
          },
          "rail": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Rail"
              }
            ],
            "nullable": true
          },
          "mode": {
            "type": "string",
            "enum": [
              "sandbox",
              "live"
            ],
            "description": "Whether this transaction was created with a sandbox (`sk_test_*`)\nor live (`sk_live_*`) API key. Sandbox transactions never touch\nreal money or real rails \u2014 they're deterministic mock charges\nfor integration testing. See `docs/SANDBOX_TESTING.md`.\n"
          },
          "gross": {
            "$ref": "#/components/schemas/Money"
          },
          "fee": {
            "$ref": "#/components/schemas/Money"
          },
          "net": {
            "$ref": "#/components/schemas/Money"
          },
          "customer": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "nullable": true,
                "format": "email"
              },
              "name": {
                "type": "string",
                "nullable": true
              },
              "phone": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "narration": {
            "type": "string",
            "nullable": true
          },
          "external_reference": {
            "type": "string",
            "nullable": true,
            "description": "Upstream rail reference (NIP session_id, Interswitch ref, etc.)"
          },
          "error_code": {
            "type": "string",
            "nullable": true,
            "description": "Set when `status=failed`. Examples: `insufficient_funds`, `do_not_honour`, `invalid_card`, `abandoned`, `processing_error`."
          },
          "failure_reason": {
            "type": "string",
            "nullable": true,
            "description": "Human-readable failure description, paired with `error_code`."
          },
          "metadata": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "posted_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reversed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "RefundRequest": {
        "type": "object",
        "required": [
          "reference"
        ],
        "properties": {
          "reference": {
            "type": "string",
            "description": "The original transaction reference"
          },
          "amount_minor": {
            "type": "integer",
            "format": "int64",
            "description": "Defaults to full remaining refundable amount"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "Refund": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "amount": {
            "$ref": "#/components/schemas/Money"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "success",
              "failed"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "VirtualAccountRequest": {
        "type": "object",
        "required": [
          "mode",
          "customer_ref"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "static",
              "dynamic"
            ]
          },
          "customer_ref": {
            "type": "string",
            "description": "Your stable customer identifier"
          },
          "amount_minor": {
            "type": "integer",
            "format": "int64",
            "description": "Required when mode=dynamic"
          },
          "currency": {
            "type": "string",
            "example": "NGN"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "VirtualAccount": {
        "type": "object",
        "properties": {
          "nuban": {
            "type": "string",
            "pattern": "^[0-9]{10}$"
          },
          "bank_code": {
            "type": "string"
          },
          "bank_name": {
            "type": "string"
          },
          "mode": {
            "type": "string",
            "enum": [
              "static",
              "dynamic"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "expired",
              "closed"
            ]
          },
          "customer_ref": {
            "type": "string"
          },
          "expected_amount": {
            "nullable": true,
            "$ref": "#/components/schemas/Money"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TransferRequest": {
        "type": "object",
        "required": [
          "to_nuban",
          "to_bank_code",
          "amount_minor",
          "currency",
          "narration"
        ],
        "properties": {
          "to_nuban": {
            "type": "string",
            "pattern": "^[0-9]{10}$"
          },
          "to_bank_code": {
            "type": "string"
          },
          "amount_minor": {
            "type": "integer",
            "format": "int64"
          },
          "currency": {
            "type": "string"
          },
          "narration": {
            "type": "string",
            "maxLength": 100
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "Transfer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "success",
              "failed",
              "reversed"
            ]
          },
          "session_id": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "$ref": "#/components/schemas/Money"
          },
          "fee": {
            "$ref": "#/components/schemas/Money"
          },
          "to": {
            "type": "object",
            "properties": {
              "nuban": {
                "type": "string"
              },
              "bank_code": {
                "type": "string"
              },
              "account_name": {
                "type": "string"
              }
            }
          },
          "narration": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "failure_reason": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "CustomerRequest": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "Customer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "Card": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          },
          "brand": {
            "type": "string",
            "example": "visa"
          },
          "masked_pan": {
            "type": "string",
            "example": "**** **** **** 4242"
          },
          "bin": {
            "type": "string"
          },
          "last4": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "exp_month": {
            "type": "integer"
          },
          "exp_year": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Balance": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "example": "NGN"
          },
          "wallet": {
            "type": "integer",
            "format": "int64",
            "description": "Spendable balance, minor units"
          },
          "pending": {
            "type": "integer",
            "format": "int64",
            "description": "Held in fraud/hold window"
          },
          "reserve": {
            "type": "integer",
            "format": "int64",
            "description": "Held as chargeback reserve"
          },
          "as_of": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Settlement": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "failed"
            ]
          },
          "period_date": {
            "type": "string",
            "format": "date"
          },
          "gross": {
            "$ref": "#/components/schemas/Money"
          },
          "fees": {
            "$ref": "#/components/schemas/Money"
          },
          "refunds": {
            "$ref": "#/components/schemas/Money"
          },
          "chargebacks": {
            "$ref": "#/components/schemas/Money"
          },
          "net": {
            "$ref": "#/components/schemas/Money"
          },
          "paid_to": {
            "type": "object",
            "properties": {
              "nuban": {
                "type": "string"
              },
              "bank_code": {
                "type": "string"
              },
              "account_name": {
                "type": "string"
              }
            }
          },
          "paid_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "FeeQuote": {
        "type": "object",
        "properties": {
          "gross": {
            "$ref": "#/components/schemas/Money"
          },
          "fee": {
            "$ref": "#/components/schemas/Money"
          },
          "net": {
            "$ref": "#/components/schemas/Money"
          },
          "schedule_code": {
            "type": "string"
          },
          "breakdown": {
            "type": "object",
            "properties": {
              "flat_minor": {
                "type": "integer"
              },
              "percentage_bps": {
                "type": "integer"
              },
              "cap_applied": {
                "type": "boolean"
              },
              "floor_applied": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "EffectiveSettings": {
        "type": "object",
        "properties": {
          "settings": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "value": {},
                "source": {
                  "type": "string",
                  "enum": [
                    "platform",
                    "platform_rail",
                    "merchant",
                    "merchant_rail",
                    "default"
                  ]
                }
              }
            }
          },
          "overrideable_keys": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Keys the merchant is allowed to PATCH"
          }
        }
      },
      "WebhookEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "event": {
            "type": "string"
          },
          "resource": {
            "type": "object",
            "additionalProperties": true
          },
          "delivery": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "attempts": {
                "type": "integer"
              },
              "last_status": {
                "type": "integer",
                "nullable": true
              },
              "last_attempted_at": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "next_retry_at": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "final": {
                "type": "boolean"
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PaginatedTransactions": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Transaction"
            }
          },
          "meta": {
            "type": "object",
            "required": [
              "page",
              "limit",
              "total",
              "last_page"
            ],
            "properties": {
              "page": {
                "type": "integer",
                "example": 1
              },
              "limit": {
                "type": "integer",
                "example": 25
              },
              "total": {
                "type": "integer",
                "example": 137
              },
              "last_page": {
                "type": "integer",
                "example": 6
              }
            }
          }
        }
      },
      "PaginatedVirtualAccounts": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VirtualAccount"
            }
          },
          "next_cursor": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "PaginatedSettlements": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Settlement"
            }
          },
          "next_cursor": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "PaginatedWebhookEvents": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEvent"
            }
          },
          "next_cursor": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "KycDocumentUploadRequest": {
        "type": "object",
        "required": [
          "kind",
          "file"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "government_id",
              "utility_bill",
              "selfie",
              "cac_certificate",
              "memart",
              "bank_statement"
            ],
            "description": "What this file represents. Phase 1 (`sole_prop`) uses `government_id`, `utility_bill`, and `selfie`."
          },
          "file": {
            "type": "string",
            "format": "binary",
            "description": "The document bytes. Max 8 MiB. MIME must be one of: `image/jpeg`, `image/png`, `image/webp`, `application/pdf`."
          }
        }
      },
      "KycDocumentUpload": {
        "type": "object",
        "required": [
          "document_id",
          "kind",
          "path",
          "size",
          "sha256",
          "uploaded_at"
        ],
        "properties": {
          "document_id": {
            "type": "string",
            "format": "uuid",
            "description": "Opaque upload id. Pair with `path` when referencing this document in a submission."
          },
          "kind": {
            "type": "string",
            "enum": [
              "government_id",
              "utility_bill",
              "selfie",
              "cac_certificate",
              "memart",
              "bank_statement"
            ]
          },
          "filename": {
            "type": "string",
            "description": "Original client-provided filename (best-effort; do not trust for security decisions)."
          },
          "path": {
            "type": "string",
            "description": "Storage path \u2014 opaque to the merchant; pass back verbatim when creating a submission.",
            "example": "kyc/42/b7b3f1a0-5e5b-4e2d-9a1e-4d7b2c4f1b9a_government_id.jpg"
          },
          "size": {
            "type": "integer",
            "description": "File size in bytes."
          },
          "mime": {
            "type": "string",
            "description": "Detected MIME type of the stored file."
          },
          "sha256": {
            "type": "string",
            "description": "Hex-encoded SHA-256 of the file bytes."
          },
          "uploaded_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "KycSubmissionDocumentRef": {
        "type": "object",
        "required": [
          "document_id",
          "path"
        ],
        "description": "Reference to a previously-uploaded document.",
        "properties": {
          "document_id": {
            "type": "string",
            "format": "uuid"
          },
          "path": {
            "type": "string"
          }
        }
      },
      "KycSubmissionRequest": {
        "type": "object",
        "required": [
          "bvn",
          "documents"
        ],
        "properties": {
          "bvn": {
            "type": "string",
            "pattern": "^[0-9]{11}$",
            "description": "11-digit Bank Verification Number. Verified inline against the configured provider; a mismatch attaches a `bvn_mismatch` risk flag but does not block submission.",
            "example": "12345678901"
          },
          "documents": {
            "type": "object",
            "description": "Map of document-kind \u2192 reference. For `sole_prop` all three (`government_id`, `utility_bill`, `selfie`) are required.",
            "required": [
              "government_id",
              "utility_bill",
              "selfie"
            ],
            "properties": {
              "government_id": {
                "$ref": "#/components/schemas/KycSubmissionDocumentRef"
              },
              "utility_bill": {
                "$ref": "#/components/schemas/KycSubmissionDocumentRef"
              },
              "selfie": {
                "$ref": "#/components/schemas/KycSubmissionDocumentRef"
              }
            }
          }
        }
      },
      "KycRiskFlag": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "example": "bvn_mismatch"
          },
          "message": {
            "type": "string",
            "example": "BVN did not match the supplied name."
          }
        }
      },
      "KycRejectionReason": {
        "type": "object",
        "required": [
          "message"
        ],
        "properties": {
          "field": {
            "type": "string",
            "nullable": true,
            "maxLength": 64,
            "description": "The submission field the reviewer is flagging, if any (`utility_bill`, `bvn`, etc.)."
          },
          "message": {
            "type": "string",
            "maxLength": 500,
            "description": "Human-readable reason, surfaced to the merchant."
          }
        }
      },
      "KycSubmission": {
        "type": "object",
        "required": [
          "id",
          "submission_type",
          "tier",
          "status",
          "submitted_at"
        ],
        "description": "Merchant-facing view of a submission. Only the BVN last-4 is returned here; the full BVN is admin-only.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "submission_type": {
            "type": "string",
            "enum": [
              "sole_prop",
              "ltd",
              "mda",
              "aggregator"
            ]
          },
          "tier": {
            "type": "string",
            "enum": [
              "tier1",
              "tier2",
              "tier3"
            ],
            "description": "Target KYC tier for this submission. `sole_prop` targets `tier2`."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "under_review",
              "approved",
              "rejected",
              "needs_corrections"
            ]
          },
          "bvn_last4": {
            "type": "string",
            "nullable": true,
            "description": "Last 4 digits of the submitted BVN. Use for confirmation displays without re-displaying the full number."
          },
          "bvn_verified_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cac_class": {
            "type": "string",
            "nullable": true,
            "enum": [
              "BN",
              "LTD",
              "PLC",
              "LLP"
            ],
            "description": "Set on LTD-flow submissions (`submission_type` \u2208 `ltd, aggregator`). `null` for sole-prop."
          },
          "rc_number": {
            "type": "string",
            "nullable": true,
            "description": "RC number (LTD/PLC/LLP) or BN number (BN). Populated by the LTD flow only."
          },
          "tin": {
            "type": "string",
            "nullable": true
          },
          "risk_flags": {
            "type": "array",
            "nullable": true,
            "items": {
              "$ref": "#/components/schemas/KycRiskFlag"
            }
          },
          "rejection_reasons": {
            "type": "array",
            "nullable": true,
            "items": {
              "$ref": "#/components/schemas/KycRejectionReason"
            },
            "description": "Populated when `status = rejected` or `needs_corrections`. When an\napproval is later revoked via the admin endpoint, this is populated\nwith a single entry whose `field` is `approval_revoked`.\n"
          },
          "submitted_at": {
            "type": "string",
            "format": "date-time"
          },
          "reviewed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "KycLtdSubmissionRequest": {
        "type": "object",
        "required": [
          "cac_class",
          "cac_number",
          "directors",
          "documents"
        ],
        "description": "Request body for `POST /merchant/kyc/submissions/ltd`. Document\nrequirements vary by `cac_class` and merchant type:\n\n| Field                  | BN | LTD/PLC/LLP | aggregator (any class) |\n|------------------------|----|-------------|------------------------|\n| `cac_certificate`      | \u2713  | \u2713           | \u2713                      |\n| `memart`               | \u2014  | \u2713           | \u2713 (if LTD/PLC/LLP)     |\n| `bank_statement`       | \u2713  | \u2713           | \u2713                      |\n| `utility_bill`         | \u2713  | \u2713           | \u2713                      |\n| `platform_agreement`   | \u2014  | \u2014           | \u2713                      |\n",
        "properties": {
          "cac_class": {
            "type": "string",
            "enum": [
              "BN",
              "LTD",
              "PLC",
              "LLP"
            ]
          },
          "cac_number": {
            "type": "string",
            "pattern": "^[0-9]{1,12}$",
            "description": "RC number (LTD/PLC/LLP) or BN number (BN). Digits only, 1-12 chars.",
            "example": "1234567"
          },
          "tin": {
            "type": "string",
            "nullable": true,
            "pattern": "^[0-9]{8,15}$",
            "description": "Optional Tax Identification Number, 8-15 digits."
          },
          "directors": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "description": "Directors (LTD/PLC/LLP) or owners (BN). At least one required.",
            "items": {
              "type": "object",
              "required": [
                "name",
                "bvn"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 2,
                  "maxLength": 120
                },
                "bvn": {
                  "type": "string",
                  "pattern": "^[0-9]{11}$",
                  "description": "11-digit BVN. Verified inline at submission time."
                }
              }
            }
          },
          "documents": {
            "type": "object",
            "required": [
              "cac_certificate",
              "bank_statement",
              "utility_bill"
            ],
            "properties": {
              "cac_certificate": {
                "$ref": "#/components/schemas/KycSubmissionDocumentRef"
              },
              "memart": {
                "$ref": "#/components/schemas/KycSubmissionDocumentRef"
              },
              "bank_statement": {
                "$ref": "#/components/schemas/KycSubmissionDocumentRef"
              },
              "utility_bill": {
                "$ref": "#/components/schemas/KycSubmissionDocumentRef"
              },
              "platform_agreement": {
                "$ref": "#/components/schemas/KycSubmissionDocumentRef"
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "status",
          "code",
          "message"
        ],
        "properties": {
          "status": {
            "type": "string",
            "example": "error"
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable code",
            "example": "VALIDATION_FAILED"
          },
          "message": {
            "type": "string",
            "description": "Human-readable summary"
          },
          "request_id": {
            "type": "string",
            "description": "Echo of X-Request-Id; include this in support tickets"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Malformed request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Resource not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ValidationError": {
        "description": "Request body failed validation",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "IdempotencyConflict": {
        "description": "Idempotency key re-used with a different payload",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Rate limit exceeded. Respect `Retry-After` (seconds) before retrying.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds until the next request is allowed"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "default": {
                "value": {
                  "status": "error",
                  "code": "TOO_MANY_REQUESTS",
                  "message": "Too many attempts. Please wait and try again."
                }
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "Authenticated but not authorised for this action (e.g. non-owner trying to manage the team)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "default": {
                "value": {
                  "status": "error",
                  "code": "FORBIDDEN",
                  "message": "Only owners can manage the team."
                }
              }
            }
          }
        }
      },
      "DashboardUnauthorized": {
        "description": "Sanctum token missing, invalid, or revoked",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "default": {
                "value": {
                  "status": "error",
                  "code": "UNAUTHENTICATED",
                  "message": "Your session has expired. Please log in again."
                }
              }
            }
          }
        }
      },
      "LiveModeUnavailable": {
        "description": "The endpoint refuses live API keys because real-money rails are not\nyet wired up. Use sandbox keys (`sk_test_*`) to integrate against the\ndeterministic mock collections layer until live rails ship.\n",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "examples": {
              "default": {
                "value": {
                  "status": "error",
                  "code": "LIVE_MODE_UNAVAILABLE",
                  "message": "Live mode is not yet available. Use sandbox keys (`sk_test_*`) to integrate against the mock collections layer."
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "chargeSuccess": {
      "post": {
        "summary": "charge.success",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "example": "charge.success"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Transaction"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Merchant acknowledges (any 2xx stops retries)"
          }
        }
      }
    },
    "chargeFailed": {
      "post": {
        "summary": "charge.failed",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "example": "charge.failed"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Transaction"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged"
          }
        }
      }
    },
    "transferSuccess": {
      "post": {
        "summary": "transfer.success",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "example": "transfer.success"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Transfer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged"
          }
        }
      }
    },
    "virtualAccountCredit": {
      "post": {
        "summary": "virtual_account.credit",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "string",
                    "example": "virtual_account.credit"
                  },
                  "data": {
                    "$ref": "#/components/schemas/Transaction"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged"
          }
        }
      }
    }
  }
}