{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://splitclubapp.com/schemas/v1/checkout.json",
  "title": "Checkout",
  "description": "A Pay with SplitClub checkout, as the API returns it.",
  "x-doc": "schema-checkout",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "object",
    "mode",
    "status",
    "amount",
    "currency",
    "party_size",
    "pay_by",
    "description",
    "venue",
    "external_booking_id",
    "url",
    "shares",
    "funded_amount",
    "created_at",
    "metadata"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^chk_[A-Za-z0-9]+$",
      "examples": [
        "chk_3fT9"
      ]
    },
    "object": {
      "const": "checkout"
    },
    "mode": {
      "type": "string",
      "enum": [
        "test",
        "live"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "open",
        "collecting",
        "funded",
        "completed",
        "expired",
        "canceled"
      ]
    },
    "amount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100000000,
      "description": "Money in integer minor units (cents for usd): 14500 is $145.00.",
      "x-expected": "an integer in minor units (e.g. 14500 for $145.00)",
      "examples": [
        14500
      ]
    },
    "currency": {
      "type": "string",
      "pattern": "^[a-z]{3}$",
      "description": "ISO 4217 currency code, lower case.",
      "x-expected": "a three-letter ISO 4217 code in lower case (e.g. \"usd\")",
      "examples": [
        "usd"
      ]
    },
    "party_size": {
      "type": "integer",
      "minimum": 2,
      "maximum": 50
    },
    "pay_by": {
      "type": "string",
      "format": "date-time"
    },
    "description": {
      "type": "string",
      "maxLength": 200
    },
    "venue": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "description": "null for a console sandbox (test mode)."
        },
        "name": {
          "type": "string"
        }
      }
    },
    "external_booking_id": {
      "type": "string",
      "maxLength": 128
    },
    "url": {
      "type": "string",
      "pattern": "^https://checkout\\.splitclubapp\\.com/c/chk_[A-Za-z0-9]+$"
    },
    "shares": {
      "type": "array",
      "items": {
        "$ref": "share.json"
      }
    },
    "funded_amount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100000000,
      "description": "Money in integer minor units (cents for usd): 14500 is $145.00.",
      "x-expected": "an integer in minor units (e.g. 14500 for $145.00)",
      "examples": [
        14500
      ]
    },
    "fee_amount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100000000,
      "description": "SplitClub's fee on this checkout, in minor units (snapshotted at creation). Partner view only: guests never see it.",
      "x-expected": "an integer in minor units (e.g. 14500 for $145.00)",
      "examples": [
        960
      ],
      "readOnly": true
    },
    "net_amount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100000000,
      "description": "What the venue is paid: amount - fee_amount, in minor units. Partner view only.",
      "x-expected": "an integer in minor units (e.g. 14500 for $145.00)",
      "examples": [
        47040
      ],
      "readOnly": true
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "metadata": {
      "type": "object",
      "maxProperties": 20,
      "propertyNames": {
        "type": "string",
        "minLength": 1,
        "maxLength": 40,
        "pattern": "^[A-Za-z0-9_.-]+$"
      },
      "additionalProperties": {
        "type": "string",
        "maxLength": 500
      },
      "description": "Up to 20 string keys of your own, echoed back on every read and webhook.",
      "examples": [
        {
          "order_id": "A-1042"
        }
      ]
    }
  }
}
