# 退款管理接口

退款管理接口用于处理商户系统与电商平台之间的退款申请和退款处理流程。

# 1. 退款申请查询

GET /merchant/refund/list

查询退款申请列表。

请求参数

参数名 类型 必填 描述
page Integer 页码,默认1
size Integer 每页数量,默认20,最大100
status Integer 退款状态:0-待处理,1-已同意,2-已拒绝,3-已取消
refund_type Integer 退款类型:1-仅退款,2-退货退款
start_time Long 开始时间戳
end_time Long 结束时间戳
order_code String 订单编号

响应参数

字段名 类型 描述
total Integer 总记录数
pages Integer 总页数
list Array 退款申请列表

list数组中每个对象结构:

字段名 类型 描述
refund_id String 退款单ID
order_code String 关联订单编号
refund_amount Decimal 退款金额
refund_type Integer 退款类型:1-仅退款,2-退货退款
refund_reason String 退款原因
status Integer 退款状态:0-待处理,1-已同意,2-已拒绝,3-已取消
user_id String 用户ID
apply_time Long 申请时间戳
update_time Long 更新时间戳

响应示例

{
  "code": 200,
  "message": "success",
  "data": {
    "total": 35,
    "pages": 2,
    "list": [
      {
        "refund_id": "RF10001",
        "order_code": "ORD20230601123456",
        "refund_amount": 56.80,
        "refund_type": 1,
        "refund_reason": "不想要了",
        "status": 0,
        "user_id": "U100232",
        "apply_time": 1623126000000,
        "update_time": 1623126000000
      },
      {
        "refund_id": "RF10002",
        "order_code": "ORD20230602123456",
        "refund_amount": 128.50,
        "refund_type": 2,
        "refund_reason": "商品质量问题",
        "status": 1,
        "user_id": "U100233",
        "apply_time": 1623212400000,
        "update_time": 1623216000000
      }
    ]
  },
  "timestamp": 1623123456789
}

# 2. 退款申请详情

GET /merchant/refund/detail

查询退款申请详情。

请求参数

参数名 类型 必填 描述
refund_id String 退款单ID

响应参数

字段名 类型 描述
refund_id String 退款单ID
order_code String 关联订单编号
refund_amount Decimal 退款金额
refund_type Integer 退款类型:1-仅退款,2-退货退款
refund_reason String 退款原因
refund_desc String 退款说明
status Integer 退款状态:0-待处理,1-已同意,2-已拒绝,3-已取消
user_id String 用户ID
user_name String 用户名称
user_phone String 用户手机号
apply_time Long 申请时间戳
update_time Long 更新时间戳
handle_time Long 处理时间戳
handle_note String 处理备注
reject_reason String 拒绝原因
refund_images Array 退款凭证图片URL数组
items Array 退款商品项

items数组中每个对象结构:

字段名 类型 描述
item_id String 订单项ID
sku_code String 商品SKU编码
product_name String 商品名称
product_image String 商品图片URL
quantity Integer 退款数量
price Decimal 单价
total_amount Decimal 总金额
reason String 退款原因

响应示例

{
  "code": 200,
  "message": "success",
  "data": {
    "refund_id": "RF10001",
    "order_code": "ORD20230601123456",
    "refund_amount": 56.80,
    "refund_type": 1,
    "refund_reason": "不想要了",
    "refund_desc": "请尽快处理",
    "status": 0,
    "user_id": "U100232",
    "user_name": "张三",
    "user_phone": "13800138000",
    "apply_time": 1623126000000,
    "update_time": 1623126000000,
    "handle_time": null,
    "handle_note": null,
    "reject_reason": null,
    "refund_images": [
      "https://example.com/images/refund1.jpg",
      "https://example.com/images/refund2.jpg"
    ],
    "items": [
      {
        "item_id": "I10001",
        "sku_code": "SP123456",
        "product_name": "有机草莓",
        "product_image": "https://example.com/images/strawberry.jpg",
        "quantity": 2,
        "price": 29.90,
        "total_amount": 59.80,
        "reason": "不想要了"
      }
    ]
  },
  "timestamp": 1623123456789
}

# 3. 同意退款

POST /merchant/refund/approve

商户同意用户的退款申请。

请求参数

参数名 类型 必填 描述
refund_id String 退款单ID
handle_note String 处理备注
actual_refund_amount Decimal 实际退款金额,不传则按申请金额退款

响应参数

字段名 类型 描述
refund_id String 退款单ID
status Integer 更新后的退款状态
update_time Long 更新时间戳

请求示例

{
  "refund_id": "RF10001",
  "handle_note": "同意退款",
  "actual_refund_amount": 56.80
}

响应示例

{
  "code": 200,
  "message": "success",
  "data": {
    "refund_id": "RF10001",
    "status": 1,
    "update_time": 1623128000000
  },
  "timestamp": 1623123456789
}

# 4. 拒绝退款

POST /merchant/refund/reject

商户拒绝用户的退款申请。

请求参数

参数名 类型 必填 描述
refund_id String 退款单ID
reject_reason String 拒绝原因
handle_note String 处理备注

响应参数

字段名 类型 描述
refund_id String 退款单ID
status Integer 更新后的退款状态
update_time Long 更新时间戳

请求示例

{
  "refund_id": "RF10001",
  "reject_reason": "商品已使用,不符合退款条件",
  "handle_note": "客户已使用商品"
}

响应示例

{
  "code": 200,
  "message": "success",
  "data": {
    "refund_id": "RF10001",
    "status": 2,
    "update_time": 1623128000000
  },
  "timestamp": 1623123456789
}

# 5. 退款进度查询

GET /merchant/refund/progress

查询退款处理进度。

请求参数

参数名 类型 必填 描述
refund_id String 退款单ID

响应参数

字段名 类型 描述
refund_id String 退款单ID
status Integer 退款状态:0-待处理,1-已同意,2-已拒绝,3-已取消,4-退款中,5-退款成功,6-退款失败
refund_amount Decimal 退款金额
actual_refund_amount Decimal 实际退款金额
apply_time Long 申请时间戳
handle_time Long 处理时间戳
refund_time Long 退款完成时间戳
progress_nodes Array 退款进度节点列表

progress_nodes数组中每个对象结构:

字段名 类型 描述
node_time Long 节点时间戳
node_status Integer 节点状态
node_desc String 节点描述
operator String 操作人
operator_role String 操作人角色
remarks String 备注

响应示例

{
  "code": 200,
  "message": "success",
  "data": {
    "refund_id": "RF10001",
    "status": 5,
    "refund_amount": 56.80,
    "actual_refund_amount": 56.80,
    "apply_time": 1623126000000,
    "handle_time": 1623128000000,
    "refund_time": 1623129600000,
    "progress_nodes": [
      {
        "node_time": 1623126000000,
        "node_status": 0,
        "node_desc": "用户申请退款",
        "operator": "张三",
        "operator_role": "用户",
        "remarks": "不想要了"
      },
      {
        "node_time": 1623128000000,
        "node_status": 1,
        "node_desc": "商户同意退款",
        "operator": "商户客服",
        "operator_role": "商户",
        "remarks": "同意退款"
      },
      {
        "node_time": 1623128600000,
        "node_status": 4,
        "node_desc": "退款处理中",
        "operator": "系统",
        "operator_role": "系统",
        "remarks": "正在处理退款"
      },
      {
        "node_time": 1623129600000,
        "node_status": 5,
        "node_desc": "退款成功",
        "operator": "系统",
        "operator_role": "系统",
        "remarks": "退款已成功到账"
      }
    ]
  },
  "timestamp": 1623123456789
}

# 6. 退款统计查询

GET /merchant/refund/statistics

查询商户的退款统计数据。

请求参数

参数名 类型 必填 描述
start_date String 开始日期,格式:yyyy-MM-dd
end_date String 结束日期,格式:yyyy-MM-dd
store_id String 门店ID,不传则查询所有门店
group_by String 统计维度:day-按天,month-按月,store-按门店。默认按天

响应参数

字段名 类型 描述
total_refund_count Integer 总退款笔数
total_refund_amount Decimal 总退款金额
refund_rate Decimal 退款率(退款订单数/总订单数)
pending_count Integer 待处理退款笔数
approved_count Integer 已同意退款笔数
rejected_count Integer 已拒绝退款笔数
refund_type_stats Object 退款类型统计
refund_reason_stats Array 退款原因统计
details Array 明细数据(按统计维度)

refund_type_stats对象结构:

字段名 类型 描述
refund_only_count Integer 仅退款笔数
refund_only_amount Decimal 仅退款金额
return_refund_count Integer 退货退款笔数
return_refund_amount Decimal 退货退款金额

refund_reason_stats数组中每个对象结构:

字段名 类型 描述
reason String 退款原因
count Integer 该原因的退款笔数
amount Decimal 该原因的退款金额
percentage Decimal 占比

details数组中每个对象结构(按天/月统计时):

字段名 类型 描述
date String 日期
refund_count Integer 退款笔数
refund_amount Decimal 退款金额
refund_rate Decimal 退款率

details数组中每个对象结构(按门店统计时):

字段名 类型 描述
store_id String 门店ID
store_name String 门店名称
refund_count Integer 退款笔数
refund_amount Decimal 退款金额
refund_rate Decimal 退款率

响应示例

{
  "code": 200,
  "message": "success",
  "data": {
    "total_refund_count": 58,
    "total_refund_amount": 4932.50,
    "refund_rate": 0.043,
    "pending_count": 5,
    "approved_count": 50,
    "rejected_count": 3,
    "refund_type_stats": {
      "refund_only_count": 40,
      "refund_only_amount": 3500.20,
      "return_refund_count": 18,
      "return_refund_amount": 1432.30
    },
    "refund_reason_stats": [
      {
        "reason": "商品质量问题",
        "count": 25,
        "amount": 2150.50,
        "percentage": 0.43
      },
      {
        "reason": "不想要了",
        "count": 18,
        "amount": 1520.80,
        "percentage": 0.31
      },
      {
        "reason": "发错商品",
        "count": 10,
        "amount": 986.50,
        "percentage": 0.17
      },
      {
        "reason": "其他原因",
        "count": 5,
        "amount": 274.70,
        "percentage": 0.09
      }
    ],
    "details": [
      {
        "date": "2023-06-01",
        "refund_count": 12,
        "refund_amount": 1028.50,
        "refund_rate": 0.038
      },
      {
        "date": "2023-06-02",
        "refund_count": 15,
        "refund_amount": 1342.80,
        "refund_rate": 0.045
      },
      {
        "date": "2023-06-03",
        "refund_count": 18,
        "refund_amount": 1486.20,
        "refund_rate": 0.052
      },
      {
        "date": "2023-06-04",
        "refund_count": 13,
        "refund_amount": 1075.00,
        "refund_rate": 0.037
      }
    ]
  },
  "timestamp": 1623123456789
}

# 7. 退款回调通知

POST {merchant_callback_url}/refund/notify

当平台处理退款后,向商户系统推送退款结果通知。商户需要提供接收此通知的接口。

请求参数

参数名 类型 必填 描述
timestamp Long 时间戳
sign String 签名,详见签名规则
merchant_id String 商户ID
refund_id String 退款单ID
order_code String 订单编号
status Integer 退款状态:4-退款中,5-退款成功,6-退款失败
refund_amount Decimal 退款金额
refund_time Long 退款处理时间戳
refund_channel String 退款渠道:ALIPAY-支付宝,WECHAT-微信,BANK-银行卡
channel_refund_no String 渠道退款单号
fail_reason String 退款失败原因
items Array 退款商品明细

items数组中每个对象结构:

字段名 类型 描述
item_id String 订单项ID
sku_code String 商品SKU编码
quantity Integer 退款数量
refund_amount Decimal 退款金额

响应参数

字段名 类型 描述
code Integer 返回码:200-成功,其他-失败
message String 返回信息

请求示例

{
  "timestamp": 1623129600000,
  "sign": "abcdef1234567890",
  "merchant_id": "M10001",
  "refund_id": "RF10001",
  "order_code": "ORD20230601123456",
  "status": 5,
  "refund_amount": 56.80,
  "refund_time": 1623129600000,
  "refund_channel": "ALIPAY",
  "channel_refund_no": "2023060122001012345678901",
  "fail_reason": null,
  "items": [
    {
      "item_id": "I10001",
      "sku_code": "SP123456",
      "quantity": 2,
      "refund_amount": 59.80
    }
  ]
}

响应示例

{
  "code": 200,
  "message": "success"
}

注意:商户系统必须在收到通知后返回成功响应,否则平台会按一定间隔(如:1分钟,5分钟,15分钟)重新发送通知,直到收到成功响应或达到最大重试次数。