File size: 2,942 Bytes
84b3337
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60e423e
84b3337
60e423e
 
 
 
84b3337
 
60e423e
 
 
 
 
 
 
 
 
 
 
84b3337
 
 
 
 
 
 
 
60e423e
 
 
 
 
 
 
 
 
84b3337
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
  "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"
    }
  }
}