[
  {
    "name": "GET /categories 分类列表",
    "request": {
      "method": "GET",
      "route": "categories",
      "headers": {
        "appkey": "ak5f1a2b3c4d5e6f7089",
        "timestamp": "1765000000",
        "nonce": "b1c2d3e4f5a6b7c8",
        "signature": "<HMAC-SHA256(canonical, SECRET)>"
      },
      "body": ""
    },
    "response": {
      "code": 0,
      "msg": "ok",
      "data": {
        "total": 2,
        "list": [
          { "id": 1, "name": "游戏充值", "icon": "", "image": "", "sort": 0 },
          { "id": 2, "name": "软件激活码", "icon": "", "image": "", "sort": 1 }
        ]
      }
    }
  },
  {
    "name": "GET /goods 商品列表（参数：page / per_page / category_id / keyword）",
    "request": {
      "method": "GET",
      "route": "goods",
      "query": { "page": 1, "per_page": 20, "category_id": 0, "keyword": "" }
    },
    "response": {
      "code": 0,
      "msg": "ok",
      "data": {
        "total": 12, "page": 1, "per_page": 20, "total_page": 1,
        "list": [
          {
            "id": 5,
            "name": "XX会员月卡",
            "category_id": 2,
            "description": "官方直充，秒发货",
            "image": "/uploads/goods/5.jpg",
            "price": "18.00",
            "goods_type": "card",
            "sales": 356,
            "stock": 99
          }
        ]
      }
    }
  },
  {
    "name": "GET /goods/{id} 商品详情",
    "response": {
      "code": 0,
      "msg": "ok",
      "data": {
        "id": 5, "name": "XX会员月卡", "category_id": 2,
        "description": "官方直充，秒发货", "image": "/uploads/goods/5.jpg",
        "price": "18.00", "goods_type": "card", "sales": 356, "stock": 99,
        "description_html": "<p>购买后自动发货</p>",
        "min_quantity": 1, "max_per_user": 0, "create_time": 1764000000
      }
    }
  },
  {
    "name": "GET /stock 批量库存（goods_ids 逗号分隔，最多 100 个；stock=null 表示不限量）",
    "request": {
      "method": "GET",
      "route": "stock",
      "query": { "goods_ids": "5,6" }
    },
    "response": {
      "code": 0,
      "msg": "ok",
      "data": {
        "list": [
          { "goods_id": 5, "exists": 1, "name": "XX会员月卡", "stock": 99, "status": 1 },
          { "goods_id": 6, "exists": 0, "name": "", "stock": 0, "status": 0 }
        ]
      }
    }
  },
  {
    "name": "POST /order 创建待支付订单（external_order_no 幂等键，重复提交返回同一笔订单）",
    "request": {
      "method": "POST",
      "route": "order",
      "body": {
        "goods_id": 5,
        "quantity": 1,
        "buyer_email": "buyer@example.com",
        "buyer_qq": "可选",
        "buyer_remark": "备注可空",
        "external_order_no": "EXT2026120500001",
        "pay_type": "alipay"
      }
    },
    "response": {
      "code": 0,
      "msg": "ok",
      "data": {
        "order_no": "20261205093012345678",
        "external_order_no": "EXT2026120500001",
        "status": 0,
        "status_text": "待支付",
        "pay_amount": "18.00",
        "quantity": 1,
        "goods_name": "XX会员月卡",
        "create_time": 1765000000,
        "expire_time": 1765001800,
        "pay_url": "https://pay.example.com/submit.php?pid=1001&type=alipay&out_trade_no=...",
        "cashier_url": "https://your-faka-site.com/order_query.php?order_no=20261205093012345678",
        "channels": [
          { "type": "alipay", "name": "支付宝" },
          { "type": "wxpay", "name": "微信支付" }
        ]
      }
    }
  },
  {
    "name": "GET /order/{no} 订单查询（本站单号或外部单号均可；已发货且未退款时下发卡密）",
    "response": {
      "code": 0,
      "msg": "ok",
      "data": {
        "order_no": "20261205093012345678",
        "external_order_no": "EXT2026120500001",
        "api_source": "ak5f1a2b3c4d5e6f7089",
        "status": 3,
        "status_text": "已完成",
        "delivery_status": 2,
        "goods_id": 5,
        "goods_name": "XX会员月卡",
        "quantity": 1,
        "pay_amount": "18.00",
        "pay_type": "alipay",
        "trade_no": "2026120522001400",
        "buyer_email": "buyer@example.com",
        "create_time": 1765000000,
        "pay_time": 1765000100,
        "delivery_time": 1765000102,
        "refund_status": 0,
        "refund_amount": "0.00",
        "refund_time": 0,
        "cards": [ { "card_no": "VIP-XXXX-XXXX", "card_pwd": "******" } ]
      }
    }
  },
  {
    "name": "GET /summary 经营概要",
    "response": {
      "code": 0,
      "msg": "ok",
      "data": {
        "paid_count": 356, "paid_amount": "6408.00",
        "pending_count": 2, "pending_amount": "36.00",
        "refunded_count": 1, "refunded_amount": "18.00",
        "unsettled_count": 3, "unsettled_amount": "54.00",
        "settled_count": 352, "settled_amount": "6336.00"
      }
    }
  },
  {
    "name": "POST /order/refund 申请退款（order_no 支持本站单号或外部单号）",
    "request": {
      "method": "POST",
      "route": "order/refund",
      "body": {
        "order_no": "20261205093012345678",
        "reason": "买家申请退款"
      }
    },
    "response": {
      "code": 0,
      "msg": "退款成功",
      "data": {
        "refund_amount": "18.00",
        "order": {
          "order_no": "20261205093012345678",
          "status": 3,
          "status_text": "已完成",
          "refund_status": 1,
          "refund_amount": "18.00",
          "cards": []
        }
      }
    }
  },
  {
    "name": "鉴权失败响应样例（常见错误码：40100 缺少鉴权参数 / 40101 时间戳过期 / 40102 nonce 格式不合法 / 40103 appkey 无效或已停用 / 40104 签名错误 / 40105 重复请求 nonce 已使用 / 40301 无接口权限 / 42901 触发限流）",
    "response": { "code": 40104, "msg": "签名错误", "data": null }
  }
]
