{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pdf2md-dev/json-schema/pdf2md-dev-v2-checkout-request-schema.json",
  "title": "V2CheckoutRequest",
  "description": "Specify price_id OR (tier_code+interval). email is required only for the anonymous flow.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pdf2md-dev-openapi.json#/components/schemas/V2CheckoutRequest",
  "type": "object",
  "properties": {
    "price_id": {
      "type": "string"
    },
    "tier_code": {
      "$ref": "#/$defs/V2Tier"
    },
    "interval": {
      "type": "string",
      "enum": [
        "month",
        "year"
      ]
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "for anonymous checkout (if there is no session)"
    },
    "channel": {
      "type": "string",
      "enum": [
        "extension",
        "web"
      ],
      "description": "Checkout source for runtime purchase flags (EP-023-T23). Treat absence as web for site/pricing or by the calling client."
    },
    "trial_days": {
      "type": [
        "integer",
        "null"
      ]
    },
    "upgrade": {
      "type": "boolean",
      "default": false,
      "deprecated": true,
      "description": "IGNORED since EP-062-T4 (the server decides from the stored subscription whether ignoreActivePurchase applies). Still accepted so already-published extension builds keep working."
    },
    "intent_token": {
      "type": "string",
      "description": "EP-028: device-signed checkout-intent token (from POST /billing/checkout-intent). When valid it names the account to charge (the extension's account), overriding the web session. One-time consume; invalid/expired falls back to session/email."
    }
  },
  "$defs": {
    "V2Tier": {
      "type": "string",
      "enum": [
        "anonymous",
        "free",
        "lifetime",
        "builder",
        "pro",
        "business",
        "enterprise"
      ],
      "description": "EP-069: `lifetime` is the one-time unlock, ranked BETWEEN free and builder — it raises the interactive limits and carries 600 pages/month, but grants no API keys, hosted MCP, webhooks or batch, so a subscription is genuinely more and its holder may still buy one.\n"
    }
  }
}