{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/laboratory-love/json-schema/laboratory-love-contribution-checkout-schema.json",
  "title": "ContributionCheckout",
  "description": "A created contribution checkout.",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/laboratory-love-openapi.json#/components/schemas/ContributionCheckout",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "checkout_id",
    "checkout_url",
    "status",
    "requires_user_completion",
    "amount",
    "currency",
    "expires_at",
    "product",
    "terms",
    "next_step"
  ],
  "properties": {
    "checkout_id": {
      "type": "string",
      "description": "Checkout id for GET /checkouts/{checkout_id}."
    },
    "checkout_url": {
      "type": "string",
      "description": "Secure Stripe-hosted payment page for the person to open.",
      "format": "uri"
    },
    "status": {
      "type": "string",
      "description": "Always awaiting_user_payment on creation.",
      "enum": [
        "awaiting_user_payment"
      ]
    },
    "requires_user_completion": {
      "type": "boolean",
      "description": "Always true: nothing is charged until the person pays on checkout_url."
    },
    "amount": {
      "type": "number",
      "description": "USD."
    },
    "currency": {
      "type": "string",
      "description": "Currency.",
      "enum": [
        "USD"
      ]
    },
    "expires_at": {
      "type": [
        "string",
        "null"
      ],
      "description": "When checkout_url stops working.",
      "format": "date-time"
    },
    "product": {
      "type": "object",
      "description": "Product being funded.",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "brand",
        "amount_remaining_before_contribution",
        "product_page_url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Product id."
        },
        "name": {
          "type": "string",
          "description": "Name."
        },
        "brand": {
          "type": [
            "string",
            "null"
          ],
          "description": "Brand."
        },
        "amount_remaining_before_contribution": {
          "type": "number",
          "description": "USD still needed before this contribution."
        },
        "product_page_url": {
          "type": "string",
          "description": "Product page.",
          "format": "uri"
        }
      }
    },
    "terms": {
      "$ref": "#/$defs/ContributionTerms"
    },
    "next_step": {
      "type": "string",
      "description": "What to do next."
    }
  },
  "$defs": {
    "ContributionTerms": {
      "type": "object",
      "description": "Terms to show before a person contributes.",
      "additionalProperties": false,
      "required": [
        "seller",
        "refund_policy",
        "what_it_funds",
        "terms_url"
      ],
      "properties": {
        "seller": {
          "type": "string",
          "description": "Merchant of record."
        },
        "refund_policy": {
          "type": "string",
          "description": "Refund rules."
        },
        "what_it_funds": {
          "type": "string",
          "description": "What the money pays for."
        },
        "terms_url": {
          "type": "string",
          "description": "Full terms.",
          "format": "uri"
        }
      }
    }
  }
}