{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/recur-tw/json-schema/recur-tw-checkout-session-schema.json",
  "title": "CheckoutSession",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/recur-tw-openapi.json#/components/schemas/CheckoutSession",
  "type": "object",
  "required": [
    "id",
    "status",
    "mode",
    "amount_total",
    "currency",
    "product",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "OPEN",
        "COMPLETE",
        "EXPIRED"
      ],
      "description": "Session status:\n- `OPEN`: awaiting payment\n- `COMPLETE`: paid\n- `EXPIRED`: expired\n"
    },
    "mode": {
      "type": "string",
      "enum": [
        "PAYMENT",
        "SUBSCRIPTION",
        "SETUP"
      ]
    },
    "customer_email": {
      "type": [
        "string",
        "null"
      ],
      "format": "email",
      "description": "Customer email"
    },
    "customer_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "Customer name"
    },
    "order_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "ID of the created order"
    },
    "subscription_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "ID of the created subscription (SUBSCRIPTION mode only)"
    },
    "payment_intent_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "PaymentIntent ID"
    },
    "amount_total": {
      "type": "integer",
      "description": "Total amount. TWD is a whole-number integer: 499 means NT$499, not cents"
    },
    "currency": {
      "type": "string"
    },
    "product": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  }
}