Skip to content

V1 订单和物流 API ​

本章定义订单查询、订单出货、取消交易处理,以及店铺物流仓配置。所有数据均按 Access Token 绑定的卖家租户隔离。

Base Path: /openapi/v1

Authentication: 除特别说明外,均需传入 Authorization: Bearer <access_token>。

设计原则 ​

  • order_id 是 Sugumart 订单 ID;ruten_order_id 是露天订单号。
  • 调用方只提交当前业务动作新增的信息。订单、收件人、商品、金额和末端配送资料由 Sugumart 根据订单快照取得。
  • 订单出货使用店铺当前设置的大陆集运仓,并以卖家大陆退货仓中唯一的主要仓作为寄件地址;出货请求不能临时覆盖这两个仓库。
  • 写请求以订单当前状态为前置条件。重复请求不得重复建立履约或重复处理取消交易。
  • 露天或物流商的异步结果通过订单详情和第二章业务通知确认。

处理流程 ​

text
首次配置:GET /warehouses → POST /warehouses/selection
          POST /warehouses/seller-returns(设置主要大陆退货仓)
日常处理:GET /orders → GET /orders/{order_id}
              ├─ POST /orders/{order_id}/ship
              ├─ POST /orders/{order_id}/cancel
              └─ POST /orders/{order_id}/cancel/confirm

4.1 订单管理 ​

4.1.1 查询订单列表 ​

GET /openapi/v1/orders

本接口定位为人工查询和订单处理页面使用,不提供增量同步语义。调用方可按订单状态、创建时间或关键字筛选,并使用 limit、offset 浏览结果。

返回当前店铺的订单摘要,包括主状态为 pending(待实名)的订单;可显式传入 status=pending 单独筛选,分页 count 使用相同条件。待实名订单的 available_actions 不包含 ship,符合取消条件时仍可包含 cancel。结果固定按 created_at DESC, id DESC 排列。id 是创建时间相同时的稳定第二排序键;V1 不提供自定义排序参数。

Query Parameters ​

字段类型必填说明
limitnumber否每页数量,默认 20,范围 1-100
offsetnumber否偏移量,默认 0,必须为非负整数
qstring否精确或模糊搜索 Sugumart 订单 ID、露天订单号、商品名称或 SKU
statusstring否订单主状态;多个值使用半角逗号分隔,枚举见V1 状态附录
view_statusstring否商家展示状态;多个值使用半角逗号分隔,枚举见V1 状态附录
cancellation_pendingboolean否true 时仅返回等待卖家确认的买家取消申请
created_fromstring否创建时间下界,ISO 8601 UTC,包含边界
created_tostring否创建时间上界,ISO 8601 UTC,包含边界;不得早于 created_from

Response (200 OK) ​

字段类型说明
ordersOrderSummary[]当前页订单摘要
countnumber符合筛选条件的订单总数
limitnumber本次分页大小
offsetnumber本次分页偏移量

Response Example ​

json
{
  "success": true,
  "data": {
    "orders": [
      {
        "id": "d2e925a7-b767-407b-8624-c61388ab24b3",
        "ruten_order_id": "24080412345678",
        "status": "pending_shipment",
        "view_status": "pending_shipment",
        "buyer_name": "林小姐",
        "recipient_name": "林怡君",
        "item_count": 1,
        "quantity": 1,
        "currency": "TWD",
        "product_amount": "1200.00",
        "shipping_amount": "80.00",
        "total_amount": "1000.00",
        "cancellation": null,
        "active_fulfillment": null,
        "available_actions": [
          "ship",
          "cancel"
        ],
        "status_observed_at": "2026-08-04T03:09:55.000Z",
        "shipment_deadline_at": "2026-08-06T03:09:55.000Z",
        "created_at": "2026-08-04T02:15:00.000Z",
        "updated_at": "2026-08-04T03:10:00.000Z"
      }
    ],
    "count": 1,
    "limit": 20,
    "offset": 0
  }
}

Error Responses ​

Statuscode说明
400validation_error查询参数、状态或时间范围无效
401unauthorizedAccess Token 无效或已过期

4.1.2 查询订单详情 ​

GET /openapi/v1/orders/{order_id}

返回订单商品、金额、收件信息、取消交易和当前履约资料。调用出货或取消接口前,应以本接口返回的 available_actions 判断当前允许操作。ruten_payload 是订单同步时保存在 Sugumart 数据库内的露天详情快照,不会在查询时实时请求露天。

Path Parameters ​

字段类型必填说明
order_idstring(uuid)是Sugumart 订单 ID

Response (200 OK) ​

字段类型说明
orderOrderDetail订单完整详情

Response Example ​

json
{
  "success": true,
  "data": {
    "order": {
      "id": "d2e925a7-b767-407b-8624-c61388ab24b3",
      "ruten_order_id": "24080412345678",
      "status": "pending_shipment",
      "view_status": "pending_shipment",
      "currency": "TWD",
      "product_amount": "1200.00",
      "shipping_amount": "80.00",
      "total_amount": "1000.00",
      "recipient_name": "林怡君",
      "recipient_phone": "0912345678",
      "shipping_address": {
        "name": "林怡君",
        "phone": "0912345678",
        "city": "台北市",
        "district": "中山区",
        "address_1": "南京东路三段 100 号",
        "country_code": "TW",
        "identity_name": "林怡君",
        "identity_number_masked": "A1******89"
      },
      "items": [
        {
          "id": "58dff493-4174-4896-825d-8bc36f8bbc39",
          "ruten_item_id": "22408041234567",
          "sku": "BAG-BLK-20",
          "spec_name": "黑色 / 20L",
          "item_name": "轻量防泼水通勤背包",
          "quantity": 1,
          "currency": "TWD",
          "unit_price": "1200.00",
          "product_amount": "1200.00"
        }
      ],
      "ruten_payload": {
        "order_id": "24080412345678"
      },
      "cancellation": null,
      "fulfillment": null,
      "available_actions": [
        "ship",
        "cancel"
      ],
      "status_observed_at": "2026-08-04T03:09:55.000Z",
      "shipment_deadline_at": "2026-08-06T03:09:55.000Z",
      "created_at": "2026-08-04T02:15:00.000Z",
      "updated_at": "2026-08-04T03:10:00.000Z"
    }
  }
}

Error Responses ​

Statuscode说明
401unauthorizedAccess Token 无效或已过期
404order_not_found订单不存在或不属于当前店铺

4.1.3 订单出货 ​

POST /openapi/v1/orders/{order_id}/ship

为待出货订单登记一个或多个大陆快递单号并建立跨境履约。Sugumart 自动从订单、SKU 和店铺配置取得集运仓、末端配送、收件人、发件人、商品、重量及申报金额。提交给物流商的 total_value 按 product_amount 计算,cod_value 按 product_amount + shipping_amount 计算;任一金额缺失时拒绝出货,不使用已经扣除露天卖家折扣、优惠及露币的 total_amount。

前置条件 ​

  • available_actions 包含 ship。
  • 店铺已设置有效的大陆集运仓,并至少设置一个卖家大陆退货仓且唯一标记一个主要仓。
  • 订单收件人与清关资料完整。
  • 每个订单商品已关联有效 SKU,且具备物流商要求的重量及申报资料。
  • 订单必须具备有效的 product_amount 和 shipping_amount;任一金额缺失时拒绝出货,不以 total_amount 或固定运费回退值替代。
  • 一个订单在 V1 中只建立一个有效履约,该履约可关联多个大陆快递单号;本接口不支持按商品数量拆包或分批发货。

Path Parameters ​

字段类型必填说明
order_idstring(uuid)是Sugumart 订单 ID

Request Body ​

字段类型必填说明
drop_ordersShipmentPackage[]条件必填推荐的新格式;至少一个包裹,每项分别指定单号与快递公司。不能与 tracking_number 或顶层 carrier_code 混用
tracking_numberstring条件必填兼容单号字段;未提供 drop_orders 时必填。去除首尾空格后长度 1-100,不接受 null 或空字符串
transport_modestring否跨境运输方式:sea 海运、sea_express 海快、air 空运;新发货省略默认海运,不接受 null 或空字符串
carrier_codestring否仅用于旧格式的统一大陆快递公司代码,去除首尾空格后长度 1-64,不接受 null 或空字符串;提供时用于全部旧格式单号,省略时逐条识别

ShipmentPackage 字段:

字段类型必填说明
tracking_numberstring是大陆快递单号;去除首尾空格后长度 1-100,不接受 null 或空字符串
carrier_codestring是该单号的快递公司代码;去除首尾空格后长度 1-64,不接受 null 或空字符串。例如顺丰 SFExpress、京东 JD;当前按字符串校验,不作枚举限制

新格式按包裹保存并向物流商传递各自的快递公司。包裹对象不接受未知字段;单号去除首尾空格后若重复,返回 400 validation_error,即使两项的公司不同也不允许重复。carrier_code=OTHER 会继续尝试自动识别,不能用于强制关闭识别。

未提供 drop_orders 时,必须提供单号字段 tracking_number。多包裹统一使用 drop_orders,不再提供独立的单号数组;未知请求字段返回 400 validation_error。

兼容说明:旧文档要求无法识别快递公司时必须提供 carrier_code,当前实现采用 OTHER,不会仅因无法识别而返回 carrier_required。新接入请使用 drop_orders 为每个单号分别指定公司。旧格式仍支持省略顶层 carrier_code 自动识别;无法识别时使用 OTHER。

同一订单使用顺丰和京东的请求示例(新格式):

json
{
  "drop_orders": [
    { "tracking_number": "SF1234567890123", "carrier_code": "SFExpress" },
    { "tracking_number": "JD1234567890123", "carrier_code": "JD" }
  ],
  "transport_mode": "air"
}

兼容的单号请求示例:

json
{
  "tracking_number": "SF123456789CN",
  "transport_mode": "air"
}

Response (201 Created) ​

字段类型说明
orderOrderDetail已刷新状态和可用操作的订单
fulfillmentFulfillment创建后的履约资料

Response Example ​

json
{
  "success": true,
  "data": {
    "order": {
      "id": "d2e925a7-b767-407b-8624-c61388ab24b3",
      "ruten_order_id": "24080412345678",
      "status": "shipped",
      "view_status": "shipped",
      "available_actions": []
    },
    "fulfillment": {
      "id": "97e78f56-6f67-474b-91cd-3669461ec54d",
      "fulfillment_no": "SGM202608040001",
      "status": "created",
      "drop_orders": [
        {
          "id": "11111111-1111-4111-8111-111111111111",
          "tracking_number": "SF123456789CN",
          "carrier_code": "SF",
          "status": "created",
          "warehouse_received_at": null
        },
        {
          "id": "22222222-2222-4222-8222-222222222222",
          "tracking_number": "SF987654321CN",
          "carrier_code": "SF",
          "status": "created",
          "warehouse_received_at": null
        }
      ],
      "tracking_number": "SF123456789CN",
      "carrier_code": "SF",
      "transport_mode": "air",
      "warehouse_code": "20089",
      "external_order_code": "WMS2408040098",
      "drop_order_status": "created",
      "warehouse_received_at": null,
      "shipped_at": null,
      "delivered_at": null,
      "created_at": "2026-08-04T08:50:00.000Z",
      "updated_at": "2026-08-04T08:50:00.000Z"
    }
  }
}

多单号响应与重试 ​

订单列表的 active_fulfillment、订单详情的 active_fulfillment / fulfillment,以及发货响应的 order 内履约对象和 data.fulfillment 均通过 drop_orders 返回包裹资料,包含当前履约全部未软删除的大陆包裹,包含状态为 cancelled 或 failed 的包裹。包裹按创建时间升序、同一创建时间按包裹 ID 升序排列,不保证与提交数组顺序一致。

原有 tracking_number、carrier_code、drop_order_status 和 warehouse_received_at 保留,分别对应 drop_orders[0] 的单号、公司、状态和入库时间,仅用于兼容旧客户端,不代表全部包裹的状态。履约存在但无包裹时,drop_orders 为 [],上述兼容字段为 null;没有有效履约时,履约对象仍为 null。

旧文档曾约定相同单号重试返回 200 OK,当前实现尚未提供这一幂等保证;成功返回 201 Created。订单状态不允许出货时返回 409 order_not_shippable;订单仍可出货但已有不可重试的有效履约时返回 409 fulfillment_already_exists,不以单号是否相同区分。

仅当订单仍可出货,且已有履约处于 created、已生成集货单号但尚未取得物流商集货单号时,支持继续提交物流商;此时不可修改已保存的运输方式。请求超时或失败后应先查询订单及履约状态,不要将重复提交视为追加单号或分批发货。

Error Responses ​

Statuscode说明
400validation_error缺少包裹或单号字段、数组为空、单号或快递公司格式无效、新格式缺少公司、包裹单号重复、新旧字段混用或包含未知字段
400transport_mode_not_supported集货仓所属物流商未开通所选运输方式;提交前查询仓库的 transport_modes
409transport_mode_conflict已有本地履约重试不能修改已保存的运输方式
400carrier_required旧契约错误码;当前实现对无法识别的快递公司使用 OTHER,不会仅因此返回本错误
401unauthorizedAccess Token 无效或已过期
404order_not_found订单不存在或不属于当前店铺
409order_not_shippable当前订单状态不允许出货
409fulfillment_already_exists订单已有不可重试的有效履约,与本次单号是否相同无关
422shipment_configuration_incomplete物流仓、卖家主要大陆退货仓或物流商配置不完整;data.missing_fields 返回缺失项,其中缺少主要退货仓时包含 seller_return_warehouse
422order_shipment_data_incomplete订单、清关、SKU 重量或申报资料不完整;data.missing_fields 返回缺失项
503shipment_provider_error物流商暂时不可用或拒绝建立集货单

4.1.4 卖家取消交易 ​

POST /openapi/v1/orders/{order_id}/cancel

由卖家主动向露天申请取消交易。该操作不会删除 Sugumart 订单;已经进入有效履约的订单不能通过本接口取消。

调用成功表示露天已经接受取消申请或订单已经完成取消;调用方应读取响应的 cancellation.status,并通过订单详情或回调继续确认最终状态。

Path Parameters ​

字段类型必填说明
order_idstring(uuid)是Sugumart 订单 ID

Request Body ​

字段类型必填说明
reason_codestring是item_defective_or_lost、buyer_unreachable、cancelled_by_agreement、seller_out_of_stock 或 other
reasonstring条件必填reason_code=other 时必填;提供时去除首尾空格后长度 1-100。服务端自动转换为台湾繁体,转换后仍须为 1-100 字;其他原因可省略,使用对应的繁体原因文案
json
{
  "reason_code": "seller_out_of_stock"
}

选择 other 时必须填写文字,例如:

json
{
  "reason_code": "other",
  "reason": "買家要求更換商品,協議取消後重新下單"
}

也可传入简体文字,服务端会统一转换为台湾繁体后保存并提交露天。其他类型如提供 reason,也会转换;不提供时使用该类型的繁体说明。空字符串、纯空白、非字符串及超长文字均返回 400 validation_error。

Response (200 OK) ​

字段类型说明
orderOrderDetail提交取消请求后的最新订单
cancellationCancellation当前取消交易资料

Response Example ​

json
{
  "success": true,
  "data": {
    "order": {
      "id": "d2e925a7-b767-407b-8624-c61388ab24b3",
      "ruten_order_id": "24080412345678",
      "status": "pending",
      "available_actions": []
    },
    "cancellation": {
      "requested_by": "seller",
      "status": "pending",
      "reason_code": "seller_out_of_stock",
      "reason": null,
      "requested_at": "2026-08-04T09:00:00.000Z",
      "decided_at": null,
      "status_at": "2026-08-04T09:00:00.000Z"
    }
  }
}

相同取消原因的重复请求返回当前结果,不重复向露天提交;订单已有不同原因的处理中申请时返回 409 cancellation_conflict。

Error Responses ​

Statuscode说明
400validation_error取消原因无效或缺少 reason
401unauthorizedAccess Token 无效或已过期
404order_not_found订单不存在或不属于当前店铺
409order_not_cancellable当前订单状态不允许卖家取消
409fulfillment_already_exists订单已经进入有效履约
409cancellation_conflict已存在内容不同或由买家发起的取消交易
502ruten_provider_error露天未接受取消请求

4.1.5 确认买家取消交易 ​

POST /openapi/v1/orders/{order_id}/cancel/confirm

同意买家发起的取消交易。仅当 cancellation.requested_by=buyer 且 cancellation.status=pending_confirmation 时允许调用。已付款订单的款项处理由露天取消流程完成,本接口不单独发起退款。

Path Parameters ​

字段类型必填说明
order_idstring(uuid)是Sugumart 订单 ID

Request Body ​

无请求体。

Response (200 OK) ​

字段类型说明
orderOrderDetail确认后的最新订单
cancellationCancellation确认后的取消交易资料

Response Example ​

json
{
  "success": true,
  "data": {
    "order": {
      "id": "d2e925a7-b767-407b-8624-c61388ab24b3",
      "ruten_order_id": "24080412345678",
      "status": "cancelled",
      "available_actions": []
    },
    "cancellation": {
      "requested_by": "buyer",
      "status": "cancelled",
      "reason_code": "cancelled_by_agreement",
      "reason": null,
      "requested_at": "2026-08-04T08:40:00.000Z",
      "decided_at": "2026-08-04T09:05:00.000Z",
      "status_at": "2026-08-04T09:05:00.000Z"
    }
  }
}

已确认成功的重复请求返回当前结果,不重复向露天提交。

Error Responses ​

Statuscode说明
401unauthorizedAccess Token 无效或已过期
404order_not_found订单不存在或不属于当前店铺
409cancellation_not_pending当前没有等待卖家确认的买家取消申请
409cancellation_already_rejected该取消申请已经被拒绝,不能再确认
502ruten_provider_error露天未接受确认请求

4.2 物流管理 ​

4.2.1 获取露天仓库列表 ​

GET /openapi/v1/warehouses

返回当前店铺可以选择的有效物流仓。列表只包含已启用、未删除且已关联可用物流商的仓库,固定按 code ASC 排列;V1 不提供自定义排序参数。同时返回按物流商分组的 logistics_companies,供配置页面先选择物流商,再分别选择该物流商下的集运仓与退货仓。

物流商即使只提供一种仓库也会出现在分组中:缺少的一侧返回空数组;同一用途有多个仓库时全部返回,由调用方选择一个,不因缺仓或多仓排除物流商。

Query Parameters ​

字段类型必填说明
limitnumber否每页数量,默认 20,范围 1-100
offsetnumber否偏移量,默认 0,必须为非负整数
rolestring否consolidation(大陆集运仓)或 return(台湾退货仓)

Response (200 OK) ​

字段类型说明
warehousesWarehouse[]当前页可选仓库
countnumber符合条件的仓库总数
limitnumber本次分页大小
offsetnumber本次分页偏移量
logistics_companiesLogisticsCompanyWarehouses[]按物流商分组的全部可选仓库,不受当前页 limit、offset 影响
logistics_company_countnumber可选物流商数量

Response Example ​

json
{
  "success": true,
  "data": {
    "warehouses": [
      {
        "code": "20089",
        "name": "深圳集运仓",
        "role": [
          "consolidation"
        ],
        "logistics_company_code": "SUGU_LOGISTICS",
        "logistics_company_name": "Sugumart 跨境物流",
        "address": {
          "contact_name": "集运仓收货组",
          "phone": "0755-88886666",
          "province": "广东省",
          "city": "深圳市",
          "district": "宝安区",
          "address_1": "航城街道示例物流园 2 栋",
          "postal_code": "518100",
          "country_code": "CN"
        }
      }
    ],
    "count": 1,
    "limit": 20,
    "offset": 0,
    "logistics_companies": [
      {
        "logistics_company_code": "SUGU_LOGISTICS",
        "logistics_company_name": "Sugumart 跨境物流",
        "consolidation_warehouses": [
          {
            "code": "20089",
            "name": "深圳集运仓",
            "role": ["consolidation"],
            "logistics_company_code": "SUGU_LOGISTICS",
            "logistics_company_name": "Sugumart 跨境物流",
            "address": {
              "contact_name": "集运仓收货组",
              "phone": "0755-88886666",
              "province": "广东省",
              "city": "深圳市",
              "district": "宝安区",
              "address_1": "航城街道示例物流园 2 栋",
              "postal_code": "518100",
              "country_code": "CN"
            }
          }
        ],
        "return_warehouses": []
      }
    ],
    "logistics_company_count": 1
  }
}

Error Responses ​

Statuscode说明
400validation_error分页参数或 role 无效
401unauthorizedAccess Token 无效或已过期

4.2.2 获取当前物流仓 ​

GET /openapi/v1/warehouses/selection

返回当前店铺的物流仓设置及有效性。已选仓库后来被停用或不再满足规则时,仍返回其 code,并将对应 valid 设为 false,避免把错误配置静默表现为“从未设置”。

Response (200 OK) ​

字段类型说明
selectionWarehouseSelection当前店铺物流仓设置

Response Example ​

json
{
  "success": true,
  "data": {
    "selection": {
      "consolidation_warehouse": {
        "code": "20089",
        "name": "深圳集运仓",
        "valid": true,
        "invalid_reason": null
      },
      "return_warehouse": {
        "code": "20090",
        "name": "新北退货仓",
        "valid": true,
        "invalid_reason": null
      },
      "logistics_company_code": "SUGU_LOGISTICS",
      "updated_at": "2026-08-04T06:00:00.000Z"
    }
  }
}

Error Responses ​

Statuscode说明
401unauthorizedAccess Token 无效或已过期
404shop_not_found当前 Token 未绑定可用店铺

4.2.3 设置物流仓 ​

POST /openapi/v1/warehouses/selection

更新当前店铺选定的大陆集运仓或台湾退货仓。请求采用局部更新语义:省略字段表示保持不变,传 null 表示清空对应设置;至少必须传入一个字段。logistics_company_code 是兼容字段,用于校验本次选择或一次清空两个仓库;服务端以仓库所属物流商为准,不单独持久化该字段。

Request Body ​

字段类型必填说明
logistics_company_codestring | null否当前选定物流商;null 会同时清空集运仓和退货仓
consolidation_warehouse_codestring | null否大陆集运仓 code;必须支持 consolidation;null 表示清空
return_warehouse_codestring | null否台湾退货仓 code;必须支持 return;null 表示清空
json
{
  "logistics_company_code": "SUGU_LOGISTICS",
  "consolidation_warehouse_code": "20089",
  "return_warehouse_code": "20090"
}

选择规则:

  • 集运仓必须位于大陆并支持集运;退货仓必须位于台湾并支持退货。
  • 仓库必须启用、未删除且已关联可用物流商。
  • 两个非空仓库必须属于请求选择的同一物流商;不能跨物流商配对。
  • 物流商可缺少集运仓或退货仓,缺少的一侧保持 null;同一用途存在多个仓库时由调用方选择其中一个。
  • 清空大陆集运仓后,新的订单出货请求将被拒绝;不影响已经建立的履约。
  • 清空台湾退货仓不会阻止订单出货,但需要退货仓的后续业务不可执行。

Response (200 OK) ​

字段类型说明
selectionWarehouseSelection更新后的完整设置

Response Example ​

json
{
  "success": true,
  "data": {
    "selection": {
      "consolidation_warehouse": {
        "code": "20089",
        "name": "深圳集运仓",
        "valid": true,
        "invalid_reason": null
      },
      "return_warehouse": {
        "code": "20090",
        "name": "新北退货仓",
        "valid": true,
        "invalid_reason": null
      },
      "logistics_company_code": "SUGU_LOGISTICS",
      "updated_at": "2026-08-04T09:10:00.000Z"
    }
  }
}

使用与当前设置相同的值重复请求时,返回当前结果且不产生额外副作用。

Error Responses ​

Statuscode说明
400validation_error未提供更新字段或字段格式无效
401unauthorizedAccess Token 无效或已过期
404warehouse_not_found指定仓库不存在或当前店铺不可见
409warehouse_unavailable指定仓库已停用、删除或物流商不可用
409warehouse_role_mismatch仓库地区或能力不符合指定用途
409warehouse_provider_mismatch两个仓库不属于同一物流商

4.2.4 获取卖家大陆退货仓 ​

GET /openapi/v1/warehouses/seller-returns

返回当前店铺维护的卖家大陆退货仓。该资源与物流商提供的台湾退货仓不同;其中恰好一个 is_primary=true,作为订单出货和 WMS 集货单的寄件地址。兼容旧数据时,如尚未保存主要标记,响应会将列表第一项标记为主要。

Response (200 OK) ​

json
{
  "success": true,
  "data": {
    "warehouses": [
      {
        "id": "65bdb75c-59cb-4fe9-8a84-eaf46d6d05be",
        "label": "义乌退货仓",
        "first_name": "小明",
        "last_name": "陈",
        "company": "示例商贸",
        "address_1": "稠城街道示例路 8 号",
        "address_2": null,
        "city": "义乌市",
        "province": "浙江省",
        "country_code": "CN",
        "postal_code": "322000",
        "phone": "13800000000",
        "identity_number_masked": "12********34",
        "identity_name": "陈小明",
        "identity_phone": "13800000000",
        "is_primary": true
      }
    ]
  }
}

4.2.5 替换卖家大陆退货仓 ​

POST /openapi/v1/warehouses/seller-returns

使用完整列表替换当前店铺的全部卖家大陆退货仓,不影响历史大陆发货仓等其他内部地址。请求必须包含 1-5 个仓库,并且恰好一个 is_primary=true;重复提交同一完整列表可安全重试。

id 可省略,由服务端生成;更新已有仓库时应回传其 id。identity_number 是只写敏感字段:GET 仅返回脱敏值;更新同一 id 且省略该字段时保留原值,传入字符串时替换原值。

Request Body ​

字段类型必填说明
warehousesSellerReturnWarehouseInput[]是完整退货仓列表,1-5 项
warehouses[].idstring否已有仓库 ID;同一请求内不得重复
warehouses[].labelstring是仓库名称,1-50 字
warehouses[].first_namestring是联系人名字,1-20 字
warehouses[].last_namestring否联系人姓氏,最长 20 字,默认空字符串
warehouses[].companystring否公司名称,最长 100 字,默认空字符串
warehouses[].address_1string是详细地址,1-200 字
warehouses[].address_2string否补充地址,最长 200 字,默认空字符串
warehouses[].citystring是城市,1-50 字
warehouses[].provincestring否省份,最长 50 字,默认空字符串
warehouses[].country_codestring是国家或地区代码,1-8 字符,保存时转为大写
warehouses[].postal_codestring否邮政编码,最长 20 字,默认空字符串
warehouses[].phonestring是仓库联系电话,1-30 字
warehouses[].identity_numberstring否证件号码,最长 64 字;同 ID 更新时省略表示保留
warehouses[].identity_namestring否实名姓名,最长 50 字,默认空字符串
warehouses[].identity_phonestring否实名电话,最长 30 字,默认空字符串
warehouses[].is_primaryboolean是是否为主要退货仓;整个列表必须恰好一个 true
json
{
  "warehouses": [
    {
      "id": "65bdb75c-59cb-4fe9-8a84-eaf46d6d05be",
      "label": "义乌退货仓",
      "first_name": "小明",
      "last_name": "陈",
      "company": "示例商贸",
      "address_1": "稠城街道示例路 8 号",
      "address_2": "",
      "city": "义乌市",
      "province": "浙江省",
      "country_code": "CN",
      "postal_code": "322000",
      "phone": "13800000000",
      "identity_name": "陈小明",
      "identity_phone": "13800000000",
      "is_primary": true
    }
  ]
}

成功时返回 200 OK,data.warehouses 与 4.2.4 相同。

Error Responses ​

Statuscode说明
400validation_error列表数量、字段格式、ID 唯一性或主要仓数量不符合要求;data.fields 返回字段错误
401invalid_tokenAccess Token 无效或已过期
404shop_not_found当前 Token 未绑定可用店铺

公共响应对象 ​

OrderSummary ​

字段类型说明
idstring(uuid)Sugumart 订单 ID
ruten_order_idstring露天订单号
statusstring订单主状态,见V1 状态附录
view_statusstring商家展示状态,见V1 状态附录
buyer_namestring | null买家名称
recipient_namestring | null收件人名称
item_countnumber订单商品明细种类数,非负整数
quantitynumber商品购买总数量,非负整数
currencystringISO 4217 币种代码
product_amountstring | null商品金额,来源为露天 checkout_info.item_amount;currency 主单位 decimal string,固定 2 位小数
shipping_amountstring | null露天原始物流费,来源为 checkout_info.original_shipping_fee;currency 主单位 decimal string,固定 2 位小数
total_amountstring | null买家实际支付金额,即扣除露天卖家折扣、优惠及露币后的金额;currency 主单位 decimal string,固定 2 位小数
cancellationCancellation | null当前取消交易;不存在时为 null
active_fulfillmentFulfillmentSummary | null当前有效履约;未出货时为 null
available_actionsstring[]当前可执行操作:ship、cancel、confirm_cancellation;status=pending 时不返回 ship
status_observed_atstring | null最近一次观察到露天订单、付款、出货或取消回复状态的时间,ISO 8601 UTC;尚无外部状态观察记录时为 null。该字段不表示每次本地字段更新的时间
shipment_deadline_atstring | null兼容历史发货截止时间,ISO 8601 UTC;新分流订单为 null,且不再触发自动取消或发货阻断
created_atstring订单创建时间,ISO 8601 UTC
updated_atstring订单最近更新时间,ISO 8601 UTC

OrderDetail ​

OrderDetail 包含 OrderSummary 的全部字段,并增加以下字段:

字段类型说明
ruten_order_statusstring | null最近观察到的露天订单状态
ruten_pay_statusstring | null最近观察到的露天付款状态
ruten_shipping_statusstring | null最近观察到的露天出货状态
ruten_respond_statusstring | null最近观察到的露天取消回复状态
buyer_phonestring | null买家联系电话
buyer_emailstring | null买家电子邮件
recipient_phonestring | null收件人联系电话
shipping_addressShippingAddress结构化收件及清关资料
itemsOrderItem[]订单商品明细
fulfillmentFulfillment | null当前有效履约完整资料
ruten_payloadRutenPayload订单同步时保存的露天订单详情脱敏快照;无快照时为空对象。当前格式及示例见下文;该字段不是稳定的 V1 结构化契约
paid_atstring | null付款时间,ISO 8601 UTC
cancelled_atstring | null取消完成时间,ISO 8601 UTC
completed_atstring | null订单完成时间,ISO 8601 UTC

RutenPayload ​

ruten_payload 是 Sugumart 同步订单时保存的露天订单详情快照,不会在查询订单详情时实时请求露天。它用于第三方系统排查来源资料或读取尚未纳入 OrderDetail 稳定字段的露天信息。

当前快照经过脱敏处理:收件人姓名、电话、地址、超商门市及买家电子邮件等直接个人资料以 ********** 返回。买家露天账号、订单号、商品与付款物流状态等业务识别资料仍会保留。调用方仍应将整个对象视为敏感业务资料,限制访问、日志记录与保存期限。

字段类型说明
item_listobject[]露天订单商品明细;价格为 TWD 主单位整数,数量为正整数
order_infoobject露天订单编号、买家账号、状态和建立时间等资料
cancel_infoobject | null露天取消交易资料;没有取消记录时为 null
payment_infoobject付款方式、金额、付款状态和相关时间
checkout_infoobject商品、运费、优惠券与订单收入的结账金额资料;金额为 TWD 主单位整数
shipping_infoobject配送方式、出货状态、包裹和已脱敏收件资料

其中 create_time、seller_confirm_time、pay_time、transfer_time、pause_refund_time 与 ship_time 等露天原始时间字段使用 Unix timestamp(秒),尚未发生时为 null。这些字段不会转换成 V1 稳定字段所采用的 ISO 8601 格式。

以下为当前脱敏数据格式的完整示例:

json
{
  "item_list": [
    {
      "item_id": "22551750576184",
      "spec_id": "255124234615055",
      "custom_no": "5159848223715",
      "item_name": "卡諾 倉鼠窩躲避屋【選物家】芝吱多居室 倉鼠躲避窩 偷窺屋 倉鼠窩 倉鼠別墅 倉鼠木屋 倉鼠玩具 卡諾官方 B005",
      "spec_name": "M 芝吱單居室-奶酪黃",
      "discount_price": 218,
      "original_price": 218,
      "quantity_purchased": 2
    },
    {
      "item_id": "22551750576184",
      "spec_id": "255124234615044",
      "custom_no": "5035565310791",
      "item_name": "卡諾 倉鼠窩躲避屋【選物家】芝吱多居室 倉鼠躲避窩 偷窺屋 倉鼠窩 倉鼠別墅 倉鼠木屋 倉鼠玩具 卡諾官方 B005",
      "spec_name": "M 芝吱多居室-奶酪黃",
      "discount_price": 298,
      "original_price": 298,
      "quantity_purchased": 1
    }
  ],
  "order_info": {
    "buyer_id": "rutentest1187",
    "order_id": "26070761963177",
    "buyer_email": "**********",
    "create_time": 1783418124,
    "msg_to_buyer": null,
    "order_status": "ReadyToShip",
    "msg_to_seller": null,
    "seller_confirm_time": 1783418142
  },
  "cancel_info": null,
  "payment_info": {
    "account": "iw",
    "pay_way": "FMB2C_COD",
    "pay_time": null,
    "pay_amount": null,
    "pay_status": "Unpaid",
    "pay_way_text": "全家取貨付款",
    "transfer_time": null,
    "notify_pay_info": null,
    "pause_refund_time": null
  },
  "checkout_info": {
    "rpoint": 0,
    "item_amount": 734,
    "order_income": 734,
    "total_amount": 734,
    "coupon_from_ruten": 0,
    "coupon_from_seller": 0,
    "use_shipping_coupon": false,
    "original_shipping_fee": 0,
    "is_total_amount_edited": false,
    "buyer_paid_shipping_fee": 0
  },
  "shipping_info": {
    "ship_way": "FMB2C_COD",
    "ship_time": null,
    "package_info": [],
    "receiver_info": {
      "receiver_name": "**********",
      "receiver_phone": "**********",
      "receiver_mobile": "**********",
      "receiver_address": "**********",
      "receiver_store_name": "**********"
    },
    "ship_way_text": "全家取貨付款",
    "shipping_status": "Unshipped"
  }
}

上述结构记录的是当前露天上游快照格式。露天新增、删除或调整嵌套字段时,ruten_payload 可能随之变化;第三方的稳定业务逻辑应优先使用 OrderDetail 的结构化字段。

ShippingAddress ​

字段类型说明
namestring | null收件人姓名
phonestring | null收件人联系电话
postal_codestring | null邮政编码
citystring | null城市或县市
districtstring | null行政区
address_1string | null主要地址
address_2string | null补充地址
country_codestring | nullISO 3166-1 alpha-2 国家或地区代码
identity_namestring | null清关实名姓名;无资料时为 null
identity_number_maskedstring | null脱敏后的清关证件号码;不返回完整证件号

OrderItem ​

字段类型说明
idstring(uuid)订单商品明细 ID
ruten_item_idstring露天商品 ID
product_idstring(uuid) | null匹配到的 Sugumart 商品 ID
sku_idstring(uuid) | null匹配到的 Sugumart SKU ID
skustring | nullSKU 编号快照
spec_namestring | null规格名称快照
item_namestring商品名称快照
image_urlstring | null商品主图 URL
quantitynumber购买数量,正整数
currencystringISO 4217 币种代码
unit_pricestring | null单价,currency 主单位 decimal string,固定 2 位小数
product_amountstring | null商品小计,currency 主单位 decimal string,固定 2 位小数

Cancellation ​

字段类型说明
requested_bystringbuyer、seller 或 system
statusstringpending、pending_confirmation、confirmed、rejected、cancelled 或 failed
reason_codestring | null取消原因代码
reasonstring | null取消原因补充说明
requested_atstring取消申请时间,ISO 8601 UTC
decided_atstring | null确认、拒绝或系统完成处理的时间,ISO 8601 UTC
status_atstring当前取消状态生效时间,ISO 8601 UTC;未作出决定时等于 requested_at,已确认、拒绝、取消或失败时等于 decided_at

FulfillmentSummary ​

drop_orders 返回当前履约全部未软删除的大陆包裹,按创建时间及 ID 升序排列;旧单号字段只表示数组首条。履约存在但没有包裹时数组为 [],没有有效履约时整个对象为 null。

字段类型说明
idstring(uuid)履约 ID
fulfillment_nostringSugumart 集货单号
statusstring履约状态,见V1 状态附录
drop_ordersDropOrder[]大陆包裹列表,见下表;无包裹时为 []
tracking_numberstring | null兼容字段,等于 drop_orders[0].tracking_number;无包裹时为 null
carrier_codestring | null兼容字段,等于 drop_orders[0].carrier_code;无包裹时为 null
warehouse_codestring建立履约时使用的大陆集运仓 code
transport_modestring已保存的跨境运输方式:sea / sea_express / air;历史记录为 sea
created_atstring履约创建时间,ISO 8601 UTC
updated_atstring履约最近更新时间,ISO 8601 UTC

DropOrder ​

每项代表一个大陆包裹,不包含商品与包裹的数量分配。

字段类型说明
idstring(uuid)大陆包裹 ID
tracking_numberstring该包裹的大陆快递单号
carrier_codestring该包裹的大陆快递公司代码
statusstring该包裹状态:created、shipped、arrived、received、cancelled、failed;来源为 rt_shipment_drop_order.status
warehouse_received_atstring | null该包裹的集运仓签收入库时间,ISO 8601 UTC;尚未入库为 null

Fulfillment ​

Fulfillment 包含 FulfillmentSummary 的全部字段,并增加以下字段:

字段类型说明
external_order_codestring | null物流商集货单号;尚未取得时为 null
deliverer_codestring | null从露天订单取得的台湾末端承运商代码
drop_order_statusstring | null兼容字段,等于 drop_orders[0].status;无包裹时为 null
warehouse_received_atstring | null兼容字段,等于 drop_orders[0].warehouse_received_at;无包裹或首条尚未入库时为 null,ISO 8601 UTC
shipped_atstring | null集运仓出库时间,ISO 8601 UTC
delivered_atstring | null买家末端签收时间,ISO 8601 UTC
completed_atstring | null履约完成时间,ISO 8601 UTC

Warehouse ​

字段类型说明
codestring仓库 code,设置物流仓时使用
namestring仓库名称
rolestring[]支持用途:consolidation、return
logistics_company_codestring物流公司代码
logistics_company_namestring物流公司名称
transport_modesstring[]物流公司支持的方式,至少包含 sea;其他可选值 sea_express、air
addressWarehouseAddress仓库地址

WarehouseAddress ​

字段类型说明
contact_namestring | null联系人
phonestring | null联系电话
provincestring | null省份或地区
citystring | null城市
districtstring | null行政区
address_1string详细地址
postal_codestring | null邮政编码
country_codestringISO 3166-1 alpha-2 国家或地区代码

LogisticsCompanyWarehouses ​

字段类型说明
logistics_company_codestring物流公司代码
logistics_company_namestring | null物流公司名称
transport_modesstring[]仓库所属物流商支持的方式:sea / sea_express / air,至少包含 sea
consolidation_warehousesWarehouse[]该物流商可选大陆集运仓,可为空或包含多个仓库
return_warehousesWarehouse[]该物流商可选台湾退货仓,可为空或包含多个仓库

WarehouseSelection ​

字段类型说明
consolidation_warehouseSelectedWarehouse | null当前大陆集运仓;从未设置或已清空时为 null
return_warehouseSelectedWarehouse | null当前台湾退货仓;从未设置或已清空时为 null
logistics_company_codestring | null当前选择所属物流公司代码;均未设置时为 null
updated_atstring | null最近设置时间,ISO 8601 UTC;从未设置时为 null

SelectedWarehouse ​

字段类型说明
codestring已保存的仓库 code
namestring | null当前仓库名称;仓库不可用时仍保留 code,名称可能为 null
validboolean当前是否仍可用于对应业务
invalid_reasonstring | null无效原因代码;有效时为 null

SellerReturnWarehouse ​

字段类型说明
idstring店铺内地址 ID;更新时原样回传
labelstring仓库名称,最长 50 字
first_name / last_namestring / string | null联系人名字与姓氏
companystring | null公司名称
address_1 / address_2string / string | null详细地址
city / provincestring / string | null城市与省份
country_codestring国家或地区代码,保存时转为大写
postal_codestring | null邮政编码
phonestring仓库联系电话
identity_number_maskedstring | null脱敏证件号码,仅响应返回
identity_name / identity_phonestring | null实名资料
is_primaryboolean是否为唯一主要退货仓;主要仓用作 WMS 寄件地址

通用错误格式 ​

错误响应遵循 V1 统一信封;request_id 仅在请求携带 X-SGM-Request-Id 时返回,需要指出缺失资料时可在 data 中增加结构化字段。

json
{
  "success": false,
  "code": "order_shipment_data_incomplete",
  "message": "Shipment data is incomplete",
  "data": {
    "missing_fields": ["items[0].weight"]
  },
  "request_id": "550e8400-e29b-41d4-a716-446655440000"
}

注意事项 ​

  • available_actions 由订单、取消交易和履约状态计算,不是独立持久化字段。
  • 金额均使用 JSON string,单位为对应 currency 的主单位,固定 2 位小数。
  • product_amount + shipping_amount 表示商品及原始物流费合计;发货时物流商 total_value 使用 product_amount,cod_value 使用该合计。订单 total_amount 表示扣除露天卖家折扣、优惠及露币后的买家实际支付金额,不可替代前述金额。
  • 所有时间均为 ISO 8601 UTC;调用方可转换为店铺时区展示,但不得改变原始时间含义。
  • 集运仓入库、集运仓出库和买家签收是不同物流节点,不得互相替代。
  • 写请求超时后先查询订单详情,再决定是否重试。
  • ruten_payload 是数据库快照,不保证与露天当前状态实时一致;稳定业务逻辑应优先使用订单的结构化字段。

运输方式兼容规则 ​

运输方式只记录于平台履约、跨境运输事实及财务快照,本次不改变向物流商 WMS 传递的 shipping_way=EXPRESS。新请求未传 transport_mode 时默认海运;本地失败重试未传时沿用首次保存值,显式改变时返回 409 transport_mode_conflict。配置变更不影响历史运输及原方式重试;运输方式非法返回 400 validation_error,未开通返回 400 transport_mode_not_supported。