{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/shieldz-cash/json-schema/shieldz-cash-payment-link-create-schema.json",
  "title": "PaymentLinkCreate",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/shieldz-cash-openapi.json#/components/schemas/PaymentLinkCreate",
  "type": "object",
  "required": [
    "line_items"
  ],
  "properties": {
    "line_items": {
      "type": "array",
      "maxItems": 20,
      "items": {
        "type": "object",
        "description": "Send price or product. Each price can appear once.",
        "properties": {
          "price": {
            "type": "string",
            "description": "An active price (price_…) of this shop."
          },
          "product": {
            "type": "string",
            "description": "Shorthand for the product's default price. The link keeps that price ID."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 999,
            "default": 1,
            "description": "Starting quantity. Must be 1 for a customer-chosen price."
          },
          "adjustable_quantity": {
            "type": "object",
            "description": "Let the buyer change the quantity with a − / + stepper. Not allowed with a customer-chosen price.",
            "properties": {
              "enabled": {
                "type": "boolean",
                "description": "true shows the stepper."
              },
              "minimum": {
                "type": "integer",
                "minimum": 0,
                "default": 1,
                "description": "Lowest quantity the buyer can pick."
              },
              "maximum": {
                "type": "integer",
                "maximum": 999,
                "default": 99,
                "description": "Highest quantity the buyer can pick."
              }
            }
          }
        }
      }
    },
    "idempotency_key": {
      "type": "string",
      "maxLength": 256,
      "description": "Retrying with the same key returns the first object (200, idempotent_replay: true) instead of creating another. The SDKs add one for you."
    },
    "collect_email": {
      "type": "boolean",
      "default": false,
      "description": "Ask the buyer for an email before payment."
    },
    "collect_shipping_address": {
      "type": "boolean",
      "default": false,
      "description": "Ask for a shipping address. It's on the invoice as shipping, for your API key and webhooks only."
    },
    "custom_fields": {
      "type": "array",
      "maxItems": 3,
      "description": "Text questions for the buyer, like a username on your site. Answers are on the invoice as metadata.custom_fields: [{ key, label, value }]. Prefill one with ?cf_<key>=… on the link URL.",
      "items": {
        "type": "object",
        "required": [
          "key",
          "label"
        ],
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_]{1,40}$"
          },
          "label": {
            "description": "The question, up to 50 characters: a string or { type: \"custom\", custom }.",
            "oneOf": [
              {
                "type": "string",
                "maxLength": 50
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "custom"
                    ]
                  },
                  "custom": {
                    "type": "string",
                    "maxLength": 50
                  }
                }
              }
            ]
          },
          "type": {
            "type": "string",
            "enum": [
              "text"
            ],
            "default": "text"
          },
          "optional": {
            "type": "boolean",
            "default": false
          }
        }
      }
    },
    "after_completion": {
      "type": "object",
      "description": "What the buyer sees after paying. Defaults to the hosted confirmation.",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "hosted_confirmation",
            "redirect"
          ]
        },
        "hosted_confirmation": {
          "type": "object",
          "properties": {
            "custom_message": {
              "type": "string",
              "maxLength": 500,
              "description": "A thank-you note on the confirmation page."
            }
          }
        },
        "redirect": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "format": "uri",
              "description": "A public https URL to send the buyer to."
            }
          }
        }
      }
    }
  }
}