订单导入接口
- 一次最多可以导入100个订单。如果订单之前已经导入过,则会更新订单的关键信息,如订单状态等。
- 由于不同电商平台对订单的字段定义和描述各有不同,请根据蜂巢导入订单的字段说明,将对应的电商平台的订单字段值按要求导入。
一. 请求参数
请求URL:
参数名 | 类型 | 说明 | 示例 |
---|---|---|---|
appid | String | 合作伙伴AppId | |
trade_list | String | 要导入的订单列表json数据 | |
timestamp | String | 当前时间戳 | |
sign | String | 接口签名 | 如何计算生成见示例代码 |
trade_list 请求数据示例
1.主订单字段描述
字段 | 类型 | 必填 | 说明 | 示例 |
---|---|---|---|---|
trade_no | String | 是 | 订单号 | 3581388577432263461x |
status | String | 是 | 订单状态 | WAIT_BUYER_CONFIRM_GOODS |
receiver_name | String | 是/否 | 收件人姓名,密文。淘宝平台可空 | ##eaTgWhzhqyKDuQ87fVo1GgA=#1## |
receiver_name_mask | String | 是 | 收件人的脱敏姓名 | 周** |
receiver_mobile | String | 是/否 | 收件人的密文手机号,淘宝平台可空 | ##eaTgWhzhqyKDuQ87fVo1GgA=#1## |
receiver_mobile_mask | String | 是 | 收件人的脱敏手机号 | ***8797 |
receiver_province_id | String | 否 | 省的Id | 32322 |
receiver_province_name | String | 是 | 省名称 | 陕西省 |
receiver_city_id | String | 否 | 城市Id | 32132 |
receiver_city_name | String | 是 | 城市名称 | 汉中市 |
receiver_distrct_id | String | 否 | 区ID | 32314 |
receiver_distrct_name | String | 是 | 区名称 | 南郑区 |
receiver_street_id | String | 否 | 街道ID | 23424 |
receiver_street_name | String | 是 | 街道名称 | 汉山街道 |
receiver_detail_address | String | 是/否 | 详细地址的密文 ,淘宝平台可空 | ##eaTgWhzhqyKDuQ87fVo1GgA=#1## |
receiver_detail_address_mask | String | 是 | 详细地址的脱敏 | 汉街道周*路栋*室 |
exp_ship_time | String | 否 | 预计发货时间 | 2022-03-22 00:38:39 |
appointment_ship_time | String | 否 | 预约发货时间 | 2022-03-22 00:38:39 |
trade_remark | String | 否 | 卖家备注 | 老顾客 |
transit_fee | float64 | 否 | 运费,单位元 | 5 |
goods_fee | float64 | 否 | 订单金额,单位元 | 10 |
total_fee | float64 | 否 | 支付金额,单位元 | 15 |
create_date | String | 是 | 订单创建时间 | 2022-03-22 00:38:38 |
seller_nick | String | 是 | 店铺账号。 与蜂巢授权返回的 seller_nick一样的。 注意不是店铺名称。 | XX旗舰店 |
buyer_message | String | 否 | 买家留言 | 请检查质量再发 |
ship_time | String | 否 | 发货时间 | |
promotion_amount | float64 | 否 | 订单优惠总金额 | 0 |
update_time | String | 是 | 订单更新时间 | 2022-03-22 00:38:39 |
complete_date | String | 否 | 订单完成时间 | |
cancel_reason | String | 否 | 取消原因 | |
open_id | String | 否 | 买家的 OpenId | AAEU0YHcABD0D2GIOazDW_4L |
pay_time | String | 否 | 订单付款时间 | |
seller_flag | String | 否 | 卖家旗帜 | |
oaid | String | 是 | 电商平台的OAID,不同平台叫法不同,见下面的说明。 | 1F6qYM0YiaKiaRT6E3 |
trade_source_type | int | 是 | 0:电商平台密文订单。1: 私域明文订单 | 0 |
op | int | 是 | 平台代码 | 1:淘宝, 2:拼多多 , 3:抖店OMS , 5:京东 , 6:1688 ,8:快手 |
out_trade_no | String | 否 | 外部系统订单号 | DD202310250061 |
说明:
一、上面oaid值从订单(详情或增强型列表)接口中获取,不同的电商平台叫法不同。对应如下:
- 京东 : oaid
- 1688: caid
- taobao: oaid
- 抖音: open_address_id
- 拼多多:open_address_id
- 快手:oaid
2.子订单字段描述
蜂巢字段 | 类型 | 必填 | 说明 | 示例 |
---|---|---|---|---|
order_id | String | 是 | 电商平台侧的子订单号 | |
product_id | int64 | 是 | 电商平台侧的产品Id | |
product_name | String | 是 | 电商平台侧的产品名称 | |
pic_url | String | 是 | 电商平台侧的产品图片url | |
qty | int | 是 | 电商平台侧的购买数量 | |
price | float64 | 是 | 电商平台侧的单价,单位元 | |
sub_total | float64 | 是 | 电商平台侧的金额,price单价* qty数量 | |
remark | String | 否 | 自行备注 | |
spec | String | 否 | 电商平台侧的规格,不同平台格式不同,建议组装成易容易理解格式传入 | 颜色:黑色;尺码:42 |
product_code | String | 否 | 电商平台侧的外部商品编码 | |
sku_code | String | 否 | 电商平台侧的外部sku编码 | |
post_origin_amount | float64 | 否 | 电商平台侧的运费 | |
refund_status | String | 是 | 电商平台侧的子订单退款状态 | |
promotion_amount | float64 | 否 | 电商平台侧订单优惠总金额 | |
pay_amount | float64 | 否 | 电商平台侧的实付金额 | |
sku_id | int64 | 否 | 电商平台侧sku_id |
3. 请求传入订单JSON的示例
以淘宝平台为例,其他平台按上面字段要求进行组装。
[
{
"trade_no": "3581388577432263469",
"status": "WAIT_BUYER_CONFIRM_GOODS",
"receiver_name": "",
"receiver_name_mask": "周**",
"receiver_mobile": "",
"receiver_mobile_mask": "*******8797",
"receiver_province_id": "",
"receiver_province_name": "陕西省",
"receiver_city_id": "",
"receiver_city_name": "汉中市",
"receiver_distrct_id": "",
"receiver_distrct_name": "南郑区",
"receiver_street_id": "",
"receiver_street_name": "汉山街道",
"receiver_detail_address": "",
"receiver_detail_address_mask": "汉*街道周**路汉山公馆玉兰**栋***室",
"exp_ship_time": "2024-03-22 00:38:39",
"appointment_ship_time": "",
"trade_remark": "",
"transit_fee": 8,
"goods_fee": 0.9,
"total_fee": 8.9,
"create_date": "2024-03-22 00:38:38",
"seller_nick": "XX旗舰店",
"buyer_message": "",
"ship_time": "",
"promotion_amount": 0,
"update_time": "2022-03-22 00:38:39",
"complete_date": "",
"cancel_reason": "",
"open_id": "AAEU0YHcABD0D2GIOazDW_4L",
"pay_time": "",
"seller_flag": "0",
"oaid": "1F6qicravk5YgSjSLSYd1RGvj2ImZe7bIpS9I6kTnSPcY2zicd3P5vgRsU3eMYM0YiaKiaRT6E3",
"trade_source_type": 0,
"op": 1,
"out_trade_no": "DD202310250061",
"orders": [
{
"order_id": "3581388577432263461",
"product_id": 547538216335,
"product_name": "地暖辅材 分集水器标识卡扣 标记盘管 16#管",
"pic_url": "https://img.alicdn.com/bao/uploaded/i4/3192091320/O1CN01OJp8z21LcbT7prUGL_!!2-item_pic.png",
"qty": 1,
"price": 0.9,
"sub_total": 8.9,
"remark": "",
"spec": "颜色分类:客厅",
"product_code": "",
"sku_code": "4977544349948",
"post_origin_amount": 0,
"refund_status": "WAIT_BUYER_RETURN_GOODS",
"promotion_amount": 0,
"pay_amount": 8.9,
"sku_id": 0
}
]
}
]
二. 请求示例代码(Java)
@Test
public void importTrade() throws Exception {
String trades = "[{\n" + " \"trade_no\": \"3581388577432263461x\",\n" + " \"status\": \"WAIT_BUYER_CONFIRM_GOODS\",\n" + " \"receiver_name\": \"\",\n" + " \"receiver_name_mask\": \"周**\",\n" + " \"receiver_mobile\": \"\",\n" + " \"receiver_mobile_mask\": \"*******8797\",\n" + " \"receiver_province_id\": \"\",\n" + " \"receiver_province_name\": \"陕西省\",\n" + " \"receiver_city_id\": \"\",\n" + " \"receiver_city_name\": \"汉中市\",\n" + " \"receiver_distrct_id\": \"\",\n" + " \"receiver_distrct_name\": \"南郑区\",\n" + " \"receiver_street_id\": \"\",\n" + " \"receiver_street_name\": \"汉山街道\",\n" + " \"receiver_detail_address\": \"\",\n" + " \"receiver_detail_address_mask\": \"汉*街道周**路汉山公馆玉兰**栋***室\",\n" + " \"exp_ship_time\": \"2022-03-22 00:38:39\",\n" + " \"appointment_ship_time\": \"\",\n" + " \"trade_remark\": \"\",\n" + " \"transit_fee\": 8,\n" + " \"goods_fee\": 0.9,\n" + " \"total_fee\": 8.9,\n" + " \"create_date\": \"2022-03-22 00:38:38\",\n" + " \"seller_nick\": \"XX旗舰店\",\n" + " \"buyer_message\": \"\",\n" + " \"ship_time\": \"\",\n" + " \"promotion_amount\": 0,\n" + " \"update_time\": \"2022-03-22 00:38:39\",\n" + " \"complete_date\": \"\",\n" + " \"cancel_reason\": \"\",\n" + " \"open_id\": \"AAEU0YHcABD0D2GIOazDW_4L\",\n" + " \"pay_time\": \"\",\n" + " \"seller_flag\": \"0\",\n" + " \"oaid\": \"1F6qicravk5YgSjSLSYd1RGvj2ImZe7bIpS9I6kTnSPcY2zicd3P5vgRsU3eMYM0YiaKiaRT6E3\",\n" + " \"trade_source_type\": 0,\n" + " \"op\": 1,\n" + " \"out_trade_no\": \"DD202310250061\",\n" + " \"orders\": [\n" + " {\n" + " \"order_id\": \"3581388577432263461\",\n" + " \"product_id\": 547538216335,\n" + " \"product_name\": \"地暖辅材 分集水器标识卡扣 标记盘管 16#管\",\n" + " \"pic_url\": \"https://img.alicdn.com/bao/uploaded/i4/3192091320/O1CN01OJp8z21LcbT7prUGL_!!2-item_pic.png\",\n" + " \"qty\": 1,\n" + " \"price\": 0.9,\n" + " \"sub_total\": 8.9,\n" + " \"remark\": \"\",\n" + " \"spec\": \"颜色分类:客厅\",\n" + " \"product_code\": \"\",\n" + " \"sku_code\": \"4977544349948\",\n" + " \"post_origin_amount\": 0,\n" + " \"refund_status\": \"WAIT_BUYER_RETURN_GOODS\",\n" + " \"promotion_amount\": 0,\n" + " \"pay_amount\": 8.9,\n" + " \"sku_id\": 0\n" + " }\n" + " ]\n" + " }\n" + "]";
Map<String, String> data = new HashMap<String, String>();
data.put("appid", Config.AppId);
data.put("trade_list",trades);
long timestamp = System.currentTimeMillis() / 1000;
data.put("timestamp",String.valueOf(timestamp));
// 参数签名
data.put("sign", Utils.Sign(data,Config.AppSecret));
doHttpRequest(Config.FCPrinterImportTradeUrl,data);
}
三. 返回结果示例:
{"code":0,"message":"ok","data":"导入成功","trace_id":""}
说明: code为0表示成功,非0为失败,message会包含失败原因。
文档更新时间: 2024-08-16 12:02 作者:admin