{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/woocommerce/json-schema/woocommerce-order-refund-schema.json",
  "title": "OrderRefund",
  "description": "A refund associated with an order.",
  "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/OrderRefund",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "description": "Refund unique identifier."
    },
    "date_created": {
      "type": "string",
      "format": "date-time",
      "description": "Date the refund was created."
    },
    "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 of the person who issued the refund."
    },
    "line_items": {
      "type": "array",
      "description": "Line items included in the refund.",
      "items": {
        "$ref": "#/$defs/LineItem"
      }
    },
    "meta_data": {
      "type": "array",
      "description": "Custom metadata.",
      "items": {
        "$ref": "#/$defs/MetaData"
      }
    }
  },
  "$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."
        }
      }
    }
  }
}