{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/crevio-co/json-schema/crevio-co-checkout-schema.json",
  "title": "Checkout",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/crevio-co-checkouts-api-openapi.yml#/components/schemas/Checkout",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "open",
        "complete",
        "abandoned",
        "expired"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "metadata": {
      "type": "object"
    },
    "mode": {
      "type": "string"
    },
    "currency": {
      "type": [
        "string",
        "null"
      ]
    },
    "total": {
      "type": "number"
    },
    "purchase_url": {
      "type": "string"
    },
    "customer": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/Customer"
        },
        {
          "type": "null"
        }
      ],
      "description": "ID by default, full object when expanded"
    },
    "checkout_items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CheckoutItem"
      }
    }
  },
  "required": [
    "id",
    "object",
    "status",
    "created_at",
    "updated_at",
    "metadata",
    "mode",
    "currency",
    "total",
    "purchase_url",
    "checkout_items"
  ],
  "$defs": {
    "CheckoutItem": {
      "type": "object",
      "properties": {
        "object": {
          "type": "string"
        },
        "quantity": {
          "type": "integer"
        },
        "amount": {
          "type": "integer"
        },
        "price_variant": {
          "type": "string"
        },
        "product": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "object",
        "quantity",
        "amount",
        "price_variant",
        "product"
      ]
    },
    "Customer": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "first_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "phone_number": {
          "type": [
            "string",
            "null"
          ]
        },
        "customer_type": {
          "type": "string",
          "enum": [
            "paid",
            "free",
            "lead"
          ]
        },
        "notes": {
          "type": [
            "string",
            "null"
          ]
        },
        "confirmed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "deleted_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "purge_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "anonymized": {
          "type": "boolean"
        },
        "metadata": {
          "type": "object"
        },
        "orders_count": {
          "type": "integer"
        },
        "total_spend": {
          "type": "number"
        },
        "tags": {
          "type": "array"
        }
      },
      "required": [
        "id",
        "object",
        "email",
        "name",
        "first_name",
        "last_name",
        "phone_number",
        "customer_type",
        "notes",
        "confirmed_at",
        "created_at",
        "updated_at",
        "deleted_at",
        "purge_at",
        "anonymized",
        "metadata",
        "orders_count",
        "total_spend",
        "tags"
      ]
    }
  }
}