{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/studiomeyer-academy/json-schema/studiomeyer-academy-checkout-session-schema.json",
  "title": "CheckoutSession",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/studiomeyer-academy-openapi.json#/components/schemas/CheckoutSession",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "protocol": {
      "type": "object",
      "properties": {
        "version": {
          "type": "string",
          "const": "2026-04-17"
        }
      },
      "required": [
        "version"
      ],
      "additionalProperties": false
    },
    "status": {
      "type": "string",
      "enum": [
        "completed",
        "canceled",
        "expired",
        "complete_in_progress",
        "not_ready_for_payment",
        "requires_escalation"
      ]
    },
    "currency": {
      "type": "string"
    },
    "locale": {
      "type": "string",
      "enum": [
        "de",
        "en",
        "es"
      ]
    },
    "buyer": {
      "type": "object",
      "properties": {
        "first_name": {
          "type": "string",
          "maxLength": 200
        },
        "last_name": {
          "type": "string",
          "maxLength": 200
        },
        "email": {
          "type": "string",
          "format": "email",
          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        }
      },
      "additionalProperties": false
    },
    "metadata": {
      "type": "object",
      "properties": {
        "payment_mode": {
          "type": "string",
          "const": "human_hosted_checkout"
        },
        "payment_handler": {
          "type": "string",
          "const": "academy.hosted_stripe"
        },
        "hosted_checkout_session_id": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "payment_mode",
        "payment_handler",
        "hosted_checkout_session_id"
      ],
      "additionalProperties": false
    },
    "line_items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "item": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 240
              },
              "name": {
                "type": "string",
                "maxLength": 240
              },
              "unit_amount": {
                "type": "integer",
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "id"
            ],
            "additionalProperties": false
          },
          "quantity": {
            "type": "number",
            "const": 1
          },
          "totals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "subtotal",
                    "total"
                  ]
                },
                "display_text": {
                  "type": "string"
                },
                "amount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "type",
                "display_text",
                "amount"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "id",
          "item",
          "quantity",
          "totals"
        ],
        "additionalProperties": false
      }
    },
    "totals": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "subtotal",
              "total"
            ]
          },
          "display_text": {
            "type": "string"
          },
          "amount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "type",
          "display_text",
          "amount"
        ],
        "additionalProperties": false
      }
    },
    "fulfillment_options": {
      "type": "array",
      "items": {
        "not": {}
      }
    },
    "messages": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "info"
          },
          "content_type": {
            "type": "string",
            "const": "plain"
          },
          "content": {
            "type": "string"
          },
          "resolution": {
            "type": "string",
            "const": "requires_buyer_review"
          }
        },
        "required": [
          "type",
          "content_type",
          "content",
          "resolution"
        ],
        "additionalProperties": false
      }
    },
    "links": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "terms_of_use",
              "privacy_policy"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "type",
          "url"
        ],
        "additionalProperties": false
      }
    },
    "capabilities": {
      "type": "object",
      "properties": {},
      "additionalProperties": false
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
    },
    "continue_url": {
      "type": "string",
      "format": "uri"
    },
    "order": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "checkout_session_id": {
          "type": "string"
        },
        "permalink_url": {
          "type": "string",
          "format": "uri"
        },
        "status": {
          "type": "string",
          "const": "completed"
        }
      },
      "required": [
        "id",
        "checkout_session_id",
        "permalink_url",
        "status"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "id",
    "protocol",
    "status",
    "currency",
    "locale",
    "metadata",
    "line_items",
    "totals",
    "fulfillment_options",
    "messages",
    "links",
    "capabilities",
    "created_at",
    "updated_at",
    "expires_at"
  ],
  "additionalProperties": false
}