{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mentio-dev/json-schema/mentio-dev-invoice-list-schema.json",
  "title": "InvoiceList",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mentio-dev-billing-api-openapi.yml#/components/schemas/InvoiceList",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The Polar order id; what GET /v1/billing/invoices/{id}/url takes."
          },
          "createdAt": {
            "type": "string",
            "description": "When the order was placed (ISO 8601)."
          },
          "status": {
            "type": "string",
            "description": "The order status as Polar reports it (paid, refunded, ...)."
          },
          "paid": {
            "type": "boolean",
            "description": "Whether the order was paid."
          },
          "totalAmount": {
            "type": "integer",
            "description": "What was charged, in minor units of `currency`, tax included."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency of the order (usd)."
          },
          "billingReason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the order exists, as Polar reports it (purchase, subscription_cycle, ...); null when it does not say."
          }
        },
        "required": [
          "id",
          "createdAt",
          "status",
          "paid",
          "totalAmount",
          "currency",
          "billingReason"
        ]
      },
      "description": "Paid orders, newest first; empty before the first top-up."
    }
  },
  "required": [
    "data"
  ]
}