{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://splitclubapp.com/schemas/v1/checkout_create.json",
  "title": "CheckoutCreate",
  "description": "POST /v1/checkouts: start a Pay with SplitClub checkout for a party. The amount is set here, by your server, and nowhere else.",
  "x-doc": "schema-checkout-create",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "amount",
    "currency",
    "party_size",
    "pay_by",
    "description",
    "return_url",
    "external_booking_id"
  ],
  "properties": {
    "amount": {
      "type": "integer",
      "minimum": 100,
      "maximum": 100000000,
      "description": "Money in integer minor units (cents for usd): 14500 is $145.00.",
      "x-expected": "an integer in minor units, at least 100 (e.g. 48000 for $480.00)",
      "examples": [
        48000
      ]
    },
    "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,
      "examples": [
        4
      ]
    },
    "pay_by": {
      "type": "string",
      "format": "date-time",
      "examples": [
        "2026-11-06T20:00:00-05:00"
      ],
      "description": "When every share must be held; unfunded checkouts expire then and every hold is released."
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "examples": [
        "Tee time for four, Sat 8:00"
      ]
    },
    "return_url": {
      "type": "string",
      "maxLength": 2000,
      "pattern": "^https://[^\\s]{4,}$",
      "format": "uri",
      "x-expected": "an https:// URL",
      "examples": [
        "https://golf.example.com/booking/A-1042/done"
      ],
      "description": "Where the guest goes when they're done. Must be on one of your registered origins."
    },
    "cancel_url": {
      "type": "string",
      "maxLength": 2000,
      "pattern": "^https://[^\\s]{4,}$",
      "format": "uri",
      "x-expected": "an https:// URL",
      "examples": [
        "https://golf.example.com/booking/A-1042"
      ]
    },
    "external_booking_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[^\\s]+$",
      "description": "Your booking's id. Doubles as the idempotency key when no Idempotency-Key header is sent.",
      "x-expected": "your own id for it, 1–128 characters, no spaces",
      "examples": [
        "A-1042"
      ]
    },
    "offering_external_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[^\\s]+$",
      "description": "Your system's id for this object. Sending the same external_id again updates or replays it; it never makes a second one.",
      "x-expected": "your own id for it, 1–128 characters, no spaces",
      "examples": [
        "tee-sheet-4471"
      ]
    },
    "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"
        }
      ]
    }
  },
  "examples": [
    {
      "amount": 48000,
      "currency": "usd",
      "party_size": 4,
      "pay_by": "2026-11-06T20:00:00-05:00",
      "description": "Tee time for four, Sat 8:00",
      "return_url": "https://golf.example.com/booking/A-1042/done",
      "external_booking_id": "A-1042",
      "offering_external_id": "18-holes"
    }
  ]
}
