{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agentaos-ai/json-schema/agentaos-ai-subscription-invoice-schema.json",
  "title": "SubscriptionInvoice",
  "description": "One cycle's invoice on a subscription's billing history. Fully camelCase on the wire.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agentaos-ai-subscriptions-api-openapi.yml#/components/schemas/SubscriptionInvoice",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "invoiceNumber": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "issued",
        "paid",
        "voided"
      ]
    },
    "issuedAt": {
      "type": "string",
      "format": "date-time"
    },
    "amount": {
      "type": "number",
      "description": "The settled amount for this cycle: the linked capture's settlement earnings (net + fee + vat) when one is available in the invoice's own fiat currency, else the merchant's fiat_amount, else the settlement-token amount. Already resolved server-side — never recompute this."
    },
    "currency": {
      "type": "string"
    },
    "disputed": {
      "type": "boolean",
      "description": "Derived from the linked capture's dispute state, never persisted — reverts to false the instant a won dispute restores the capture. Only ever true when status is 'paid'."
    }
  },
  "required": [
    "id",
    "invoiceNumber",
    "status",
    "issuedAt",
    "amount",
    "currency",
    "disputed"
  ]
}