{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/shieldz-cash/json-schema/shieldz-cash-payment-link-schema.json",
  "title": "PaymentLink",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/shieldz-cash-openapi.json#/components/schemas/PaymentLink",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "const": "payment_link"
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "The hosted page (/l/plink_…). Share it, or put the ID on a buy button: <button data-shieldz-link=\"plink_…\">."
    },
    "active": {
      "type": "boolean",
      "description": "false once turned off; the page then says the item isn't available."
    },
    "line_items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "price": {
            "oneOf": [
              {
                "$ref": "#/$defs/Price"
              },
              {
                "type": "null"
              }
            ]
          },
          "product": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "image_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "active": {
                "type": "boolean"
              }
            }
          },
          "quantity": {
            "type": "integer"
          },
          "adjustable_quantity": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "minimum": {
                "type": "integer"
              },
              "maximum": {
                "type": "integer"
              }
            }
          }
        }
      }
    },
    "collect_email": {
      "type": "boolean"
    },
    "collect_shipping_address": {
      "type": "boolean"
    },
    "custom_fields": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "custom"
                ]
              },
              "custom": {
                "type": "string"
              }
            }
          },
          "type": {
            "type": "string",
            "enum": [
              "text"
            ]
          },
          "optional": {
            "type": "boolean"
          }
        }
      }
    },
    "after_completion": {
      "type": "object",
      "description": "{ type: \"redirect\", redirect: { url } } or { type: \"hosted_confirmation\", hosted_confirmation: { custom_message } }."
    },
    "paid_count": {
      "type": "integer",
      "description": "Invoices from this link that were paid."
    },
    "paid_usd_cents": {
      "type": "integer",
      "description": "Their total, in USD cents."
    },
    "created_at": {
      "type": "integer",
      "description": "Unix milliseconds."
    },
    "updated_at": {
      "type": "integer",
      "description": "Unix milliseconds."
    }
  },
  "$defs": {
    "Price": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "object": {
          "const": "price"
        },
        "product": {
          "type": "string",
          "description": "The product (prod_…) this price belongs to."
        },
        "active": {
          "type": "boolean",
          "description": "false once archived. An archived price can't be added to new carts or links."
        },
        "unit_amount_usd_cents": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Fixed price per unit in USD cents; null when the customer chooses the amount."
        },
        "custom_unit_amount": {
          "type": [
            "object",
            "null"
          ],
          "description": "The range the customer chooses from; null for a fixed price.",
          "properties": {
            "minimum_usd_cents": {
              "type": [
                "integer",
                "null"
              ]
            },
            "maximum_usd_cents": {
              "type": [
                "integer",
                "null"
              ]
            },
            "preset_usd_cents": {
              "type": [
                "integer",
                "null"
              ]
            }
          }
        },
        "created_at": {
          "type": "integer",
          "description": "Unix milliseconds."
        }
      }
    }
  }
}