{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/recur-tw/json-schema/recur-tw-product-schema.json",
  "title": "Product",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/recur-tw-openapi.json#/components/schemas/Product",
  "type": "object",
  "required": [
    "id",
    "name",
    "type",
    "price",
    "currency"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Product ID"
    },
    "name": {
      "type": "string",
      "description": "Product name"
    },
    "slug": {
      "type": "string",
      "description": "URL slug"
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Product description"
    },
    "type": {
      "type": "string",
      "enum": [
        "SUBSCRIPTION",
        "ONE_TIME",
        "CREDITS",
        "DONATION"
      ],
      "description": "Product type:\n- `SUBSCRIPTION`: recurring billing\n- `ONE_TIME`: single charge\n- `CREDITS`: prepaid credit pack\n- `DONATION`: donation\n"
    },
    "billing_period": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "WEEKLY",
        "MONTHLY",
        "YEARLY",
        "ONE_TIME",
        "CUSTOM"
      ],
      "description": "Billing period (subscription products only)"
    },
    "price": {
      "type": "integer",
      "description": "Price. TWD is a whole-number integer: 499 means NT$499, not cents"
    },
    "currency": {
      "type": "string",
      "default": "TWD"
    },
    "trial_days": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Trial days (subscription products only)"
    },
    "metadata": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "description": "Product metadata"
    },
    "product_family": {
      "type": [
        "string",
        "null"
      ],
      "description": "Product family, for grouping related products"
    },
    "display_order": {
      "type": "integer",
      "description": "Display order",
      "default": 0
    }
  }
}