{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/crevio-co/json-schema/crevio-co-checkout-link-schema.json",
  "title": "CheckoutLink",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/crevio-co-checkoutlinks-api-openapi.yml#/components/schemas/CheckoutLink",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "type": "string"
    },
    "name": {
      "type": [
        "string",
        "null"
      ]
    },
    "success_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "allow_discount_codes": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "metadata": {
      "type": [
        "object",
        "null"
      ]
    },
    "url": {
      "type": "string"
    },
    "discount": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/Discount"
        },
        {
          "type": "null"
        }
      ],
      "description": "ID by default, full object when expanded"
    },
    "price_variants": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PriceVariant"
      }
    }
  },
  "required": [
    "id",
    "object",
    "name",
    "success_url",
    "allow_discount_codes",
    "created_at",
    "updated_at",
    "metadata",
    "url"
  ],
  "$defs": {
    "Discount": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "inactive"
          ]
        },
        "discount_type": {
          "type": "string",
          "enum": [
            "percentage",
            "fixed"
          ]
        },
        "code": {
          "type": "string"
        },
        "amount_off": {
          "type": [
            "integer",
            "null"
          ]
        },
        "duration": {
          "type": "string",
          "enum": [
            "forever",
            "once",
            "repeating"
          ]
        },
        "duration_in_months": {
          "type": [
            "integer",
            "null"
          ]
        },
        "max_redemptions": {
          "type": [
            "integer",
            "null"
          ]
        },
        "times_redeemed": {
          "type": "integer"
        },
        "starts_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "redeem_by": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "minimum_amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "once_per_customer": {
          "type": "boolean"
        },
        "first_order_only": {
          "type": "boolean"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "percent_off": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "currency": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "id",
        "object",
        "status",
        "discount_type",
        "code",
        "amount_off",
        "duration",
        "duration_in_months",
        "max_redemptions",
        "times_redeemed",
        "starts_at",
        "redeem_by",
        "minimum_amount",
        "once_per_customer",
        "first_order_only",
        "created_at",
        "updated_at",
        "percent_off",
        "currency"
      ]
    },
    "PriceVariant": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "amount_type": {
          "type": "string",
          "enum": [
            "free",
            "fixed",
            "custom"
          ]
        },
        "billing_type": {
          "type": "string",
          "enum": [
            "subscription",
            "one_time",
            "payment_plan"
          ]
        },
        "recurring_interval": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "day",
            "week",
            "month",
            "year",
            null
          ]
        },
        "interval_count": {
          "type": "integer"
        },
        "installment_count": {
          "type": [
            "integer",
            "null"
          ]
        },
        "setup_fee_amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "trial_period_days": {
          "type": [
            "integer",
            "null"
          ]
        },
        "revoke_after_days": {
          "type": [
            "integer",
            "null"
          ]
        },
        "quantity_available": {
          "type": [
            "integer",
            "null"
          ]
        },
        "archived": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "position": {
          "type": "integer"
        },
        "hidden": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "currency": {
          "type": [
            "string",
            "null"
          ]
        },
        "discounted_from_amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "minimum_amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "maximum_amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "preset_amount": {
          "type": [
            "integer",
            "null"
          ]
        },
        "waitlist": {
          "type": "boolean"
        },
        "form_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The form (`form_...`) asked at every checkout of this variant, including waitlist applications. Its answers become a form submission on the order or waitlist entry."
        },
        "benefits": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "purchase_url": {
          "type": "string"
        },
        "product": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "object",
        "name",
        "amount",
        "amount_type",
        "billing_type",
        "recurring_interval",
        "interval_count",
        "installment_count",
        "setup_fee_amount",
        "trial_period_days",
        "revoke_after_days",
        "quantity_available",
        "archived",
        "position",
        "hidden",
        "created_at",
        "updated_at",
        "currency",
        "discounted_from_amount",
        "minimum_amount",
        "maximum_amount",
        "preset_amount",
        "waitlist",
        "form_id",
        "purchase_url",
        "product"
      ]
    }
  }
}