{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Create a item on a DID or specific record. Creates or adds to a cart and returns a checkout URL.",
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "amount": {
              "description": "Tip amount in cents",
              "type": "integer"
            },
            "cartUri": {
              "description": "AT-URI of an existing cart to add this item to. If omitted, a new cart is created.",
              "format": "at-uri",
              "type": "string"
            },
            "currency": {
              "description": "ISO 4217 currency code",
              "maxLength": 3,
              "type": "string"
            },
            "isPrivate": {
              "description": "If true, the recipient (subject) and recordUri are stored only in atiproto's private database and are omitted from the PDS item record.",
              "type": "boolean"
            },
            "message": {
              "description": "Optional message (max 500 chars)",
              "maxGraphemes": 500,
              "maxLength": 5000,
              "type": "string"
            },
            "recordUri": {
              "description": "AT-URI of specific record being tipped",
              "format": "at-uri",
              "type": "string"
            },
            "redirectUrl": {
              "description": "URL to redirect to after checkout completes",
              "format": "uri",
              "type": "string"
            },
            "subject": {
              "description": "DID of the user being tipped",
              "format": "did",
              "type": "string"
            },
            "workflow": {
              "description": "Workflow callback envelope. Present on agent-driven callbacks; absent on initial calls.",
              "ref": "com.atiproto.actions#inboundWorkflow",
              "type": "ref"
            }
          },
          "required": [
            "subject",
            "amount",
            "currency"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "cart": {
              "description": "The cart record (new or updated)",
              "ref": "com.atiproto.cart#view",
              "type": "ref"
            },
            "cartUri": {
              "description": "URI of the cart record in PDS",
              "format": "at-uri",
              "type": "string"
            },
            "checkoutUrl": {
              "description": "Checkout URL hosted by atiproto",
              "format": "uri",
              "type": "string"
            },
            "item": {
              "description": "The created item record (status: pending)",
              "ref": "com.atiproto.item#view",
              "type": "ref"
            },
            "itemUri": {
              "description": "URI of the item record in PDS",
              "format": "at-uri",
              "type": "string"
            },
            "workflow": {
              "description": "Workflow envelope. When present, the agent runs the actions and calls back. When absent, this is the final native result.",
              "ref": "com.atiproto.actions#outboundWorkflow",
              "type": "ref"
            }
          },
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "com.atiproto.payment.item.create",
  "lexicon": 1
}
