{ "id": "05_refund_processing", "version": "1.0", "domain": "payments", "method": "POST", "path": "/api/v1/refunds", "description": "Process a full or partial refund for a completed order.", "bug_count": { "simple": 1, "moderate": 2, "complex": 2, "total": 5 }, "schema": { "type": "object", "required": ["order_id", "transaction_id", "amount", "reason", "refund_method"], "properties": { "order_id": { "type": "string", "description": "ID of the order to refund" }, "transaction_id": { "type": "string", "description": "ID of the original transaction" }, "amount": { "type": "number", "description": "Refund amount; must be positive and not exceed original transaction amount" }, "reason": { "type": "string", "description": "Reason for the refund: customer_request, defective, not_as_described, duplicate, or other" }, "refund_method": { "type": "string", "description": "Refund delivery method: original, store_credit, or bank_transfer" }, "line_items": { "type": "array", "description": "Optional list of specific line items to refund; if omitted, full refund is assumed", "items": { "type": "object", "required": ["item_id", "quantity", "amount"], "properties": { "item_id": { "type": "string", "description": "ID of the line item being refunded" }, "quantity": { "type": "integer", "description": "Number of units being refunded; must be positive" }, "amount": { "type": "number", "description": "Refund amount for this line item" }, "reason": { "type": "string", "description": "Optional per-item reason for refund" } } } }, "customer_note": { "type": "string", "description": "Optional note visible to the customer explaining the refund" }, "internal_note": { "type": "string", "description": "Optional internal note not visible to the customer" }, "notify_customer": { "type": "boolean", "description": "Whether to send the customer a refund confirmation notification; defaults to true" }, "metadata": { "type": "object", "description": "Optional metadata about the source of the refund request", "properties": { "source": { "type": "string", "description": "System or channel that originated the refund (e.g. support_portal, api, backoffice)" }, "agent_id": { "type": "string", "description": "ID of the support agent who initiated the refund, if applicable" } } } } }, "sample_payload": { "order_id": "ord_7743", "transaction_id": "txn_9901", "amount": 59.99, "reason": "customer_request", "refund_method": "original", "line_items": [ { "item_id": "item_001", "quantity": 1, "amount": 59.99 } ], "notify_customer": true, "metadata": { "source": "support_portal", "agent_id": "agt_772" } } }