{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/woocommerce/json-schema/woocommerce-order-refund-input-schema.json",
  "title": "OrderRefundInput",
  "description": "Input for creating an order refund.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/woocommerce-order-refunds-api-openapi.yml#/components/schemas/OrderRefundInput",
  "type": "object",
  "properties": {
    "amount": {
      "type": "string",
      "description": "Refund amount as a decimal string."
    },
    "reason": {
      "type": "string",
      "description": "Reason for the refund."
    },
    "refunded_by": {
      "type": "integer",
      "description": "User ID issuing the refund."
    },
    "api_refund": {
      "type": "boolean",
      "description": "Whether to attempt an automatic payment gateway refund.",
      "default": true
    },
    "line_items": {
      "type": "array",
      "description": "Line items to refund with quantities and amounts.",
      "items": {
        "$ref": "#/$defs/LineItem"
      }
    }
  },
  "$defs": {
    "LineItem": {
      "type": "object",
      "description": "A product line item within an order.",
      "properties": {
        "id": {
          "type": "integer",
          "description": "Line item unique identifier."
        },
        "name": {
          "type": "string",
          "description": "Product name at time of purchase."
        },
        "product_id": {
          "type": "integer",
          "description": "Product ID."
        },
        "variation_id": {
          "type": "integer",
          "description": "Variation ID (0 if not a variation)."
        },
        "quantity": {
          "type": "integer",
          "description": "Quantity ordered."
        },
        "tax_class": {
          "type": "string",
          "description": "Tax class used for this line item."
        },
        "subtotal": {
          "type": "string",
          "description": "Line subtotal (before discounts) as a decimal string."
        },
        "subtotal_tax": {
          "type": "string",
          "description": "Line subtotal tax as a decimal string."
        },
        "total": {
          "type": "string",
          "description": "Line total (after discounts) as a decimal string."
        },
        "total_tax": {
          "type": "string",
          "description": "Line total tax as a decimal string."
        },
        "sku": {
          "type": "string",
          "description": "Product SKU."
        },
        "price": {
          "type": "number",
          "description": "Product price at time of purchase."
        },
        "meta_data": {
          "type": "array",
          "description": "Metadata for the line item (e.g. variation attributes).",
          "items": {
            "$ref": "#/$defs/MetaData"
          }
        }
      }
    },
    "MetaData": {
      "type": "object",
      "description": "Custom metadata key-value entry.",
      "properties": {
        "id": {
          "type": "integer",
          "description": "Metadata unique identifier."
        },
        "key": {
          "type": "string",
          "description": "Metadata key."
        },
        "value": {
          "type": "string",
          "description": "Metadata value."
        }
      }
    }
  }
}