{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flashdata-dev/json-schema/flashdata-dev-billing-payment-page-schema.json",
  "title": "BillingPaymentPage",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/flashdata-dev-billing-api-openapi.yml#/components/schemas/BillingPaymentPage",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "data",
    "pagination"
  ],
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/BillingPayment"
      }
    },
    "pagination": {
      "$ref": "#/$defs/Pagination"
    }
  },
  "$defs": {
    "BillingPayment": {
      "description": "Account-scoped top-up projection. Refund state is updated only from verified provider events; this API does not initiate refunds.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "purchaseType",
        "status",
        "currency",
        "amount",
        "refundedAmount",
        "credits",
        "reversedCredits",
        "createdAt"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^pay_"
        },
        "purchaseType": {
          "type": "string",
          "const": "top_up"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "paid",
            "partially_refunded",
            "refunded",
            "failed"
          ]
        },
        "currency": {
          "type": "string",
          "const": "USD"
        },
        "amount": {
          "type": "integer",
          "minimum": 0,
          "description": "USD cents"
        },
        "refundedAmount": {
          "type": "integer",
          "minimum": 0,
          "description": "USD cents"
        },
        "credits": {
          "type": "number",
          "minimum": 0,
          "multipleOf": 0.001
        },
        "hostedInvoiceUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Stripe-hosted HTTPS invoice URL, when Stripe created an invoice for this top-up."
        },
        "invoiceNumber": {
          "type": [
            "string",
            "null"
          ],
          "description": "Stripe invoice number, when available."
        },
        "reversedCredits": {
          "type": "number",
          "minimum": 0,
          "multipleOf": 0.001,
          "description": "Cumulative credits removed by append-only payment_reversal entries; never exceeds credits."
        },
        "paidAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "refundedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "Pagination": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "hasMore",
        "limit"
      ],
      "properties": {
        "nextCursor": {
          "type": [
            "string",
            "null"
          ]
        },
        "previousCursor": {
          "type": [
            "string",
            "null"
          ]
        },
        "hasMore": {
          "type": "boolean"
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        }
      }
    }
  }
}