淘宝获取订单列表(增强版)
本接口为增强型订单列表接口,除了订单列表标准的查询条件之外,还可以按买家留言、订单旗帜、卖家备注、宝贝Id等条件查询订单。
说明:
商家首次订购授权后,一般1,2分钟后即可使用本接口,时间取决于商家的历史订单数据多寡。
淘宝获取订单列表(增强版) VS 订单列表接口
这2个订单列表接口各有特点, 大家可以根据自己的场景, 选择一种或是结合使用.
订单列表接口 :
优点: 订单实时性更强, 新商家订购后也马上可以获取到订单. 可以获取商家最近90天内的历史订单及新订单. 缺点: 受淘宝大促或是压测影响, 订单中的收件人等信息可能返回为空或是被限流.淘宝获取订单列表(增强版)
优点: 稳定性更强, 不受大促或淘宝压测影响, 查询的条件维度更丰富. 获取商家授权后的最近3天的历史订单及新订单. 缺点: 新订购商家的历史订单略有延迟. 相对订单列表接口会有秒级的延迟.
建议大家在系统也接入淘宝获取订单列表(增强版) 接口 , 在淘宝限流或压测时, 可以进行同步.
1.请求参数:
请求URL:
参数名 | 类型 | 必须 | 示例值 | 说明 |
---|---|---|---|---|
appid | String | true | uwkahf@jfs92 | 合作伙伴AppId |
timestamp | String | true | 1633618722 | 当前时间戳 |
tb_seller_nick | String | true | kingdo | 淘宝卖家店铺登录账号,非店铺名称 |
sign | String | true | 999de41d862efaa6f1084ead3b3ba480 | 如何计算生成见示例代码 |
start_created | Date | true | 查询1个月内交易创建时间开始。格式:yyyy-MM-dd HH:mm:ss | |
end_created | Date | true | 查询交易创建时间结束。格式:yyyy-MM-dd HH:mm:ss | |
buyer_nick | String | fasle | 买家昵称,不能传入模糊化的买家昵称(即打星号的买家昵称) , 如果不按某个买家查询,此值可传空字符串, | |
buyer_open_uid | String | fasle | 淘宝买家昵称实施模糊化后, 买家唯一身份标识, 此值可传空字符串 | |
status | String | false | 交易状态 ,默认查询所有交易状态的数据, 除了默认值外每次只能查询一种状态。WAIT_BUYER_PAY:等待买家付款 WAIT_SELLER_SEND_GOODS:等待卖家发货 、 SELLER_CONSIGNED_PART:卖家部分发货 WAIT_BUYER_CONFIRM_GOODS:等待买家确认收货 TRADE_BUYER_SIGNED:买家已签收(货到付款专用) TRADE_FINISHED:交易成功 TRADE_CLOSED:交易关闭 | |
page_no | int | false | 当前页,默认1 | |
page_size | int | false | 每页大小, 最大500, 每100为一个阶梯 | |
buyer_message | String | false | 买家留言 ,受buyer_message_op控制 | |
buyer_message_op | String | false | 对买家留言的操作。 all 或是不传值,买家留言将不参与查询; eq: 等于 ; ne: 不等于; like: 模糊匹配(包含) | |
seller_memo | String | false | 卖家备注,受seller_memo_op控制 | |
seller_memo_op | String | false | 对卖家备注的操作。 all 或是不传值,卖家备注将不参与查询; eq: 等于 ; ne: 不等于; like: 模糊匹配(包含) | |
seller_flag | int | false | 订单旗帜不传入,表示全部 。 0: 默认(即没有插过旗) 1 :红 ,2: 黄 ,3: 绿 ,4: 蓝 ,5: 紫 | |
num_iid | long | false | 商品id | |
tid | string | false | 订单号, 如果多个订单号,请用英文逗号”,”隔开 | |
refunding | long | false | 订单退款状态,默认为全部 , 0: 表示没有退款中的订单, 1:表示有退款中的订单 | |
date_type | int | false | 查询时间(start_created和end_created)的时间类型, 0:按订单创建时间查询 ,1 :按订单更新时间查询 | |
order_asc | String | false | 查询时间(start_created和end_created)的排序,DESC:按时间降序返回,ASC: 按时间升序返回 | |
sysid | String | 100 | 可空, 代表不同的应用,具体请咨询客服 |
2. 请求示例代码(Java)
@Test
public void TaoBaoOrderExtList() throws Exception {
try {
String tb_seller_nick = Config.TBSellerNick; //要查询的淘宝商家
//业务参数
Map<String, String> data = new HashMap<String, String>();
data.put("appid", Config.AppId);
data.put("sysid", "100"); // 此值很重要,代表不同的应用,否则拉到订单,具体请咨询客服。
data.put("tb_seller_nick", tb_seller_nick);
Long timestamp = System.currentTimeMillis() / 1000;
data.put("timestamp", timestamp.toString());
data.put("start_created", "2021-10-29 00:00:00");
data.put("end_created", "2021-10-31 23:00:00");
data.put("status", "WAIT_SELLER_SEND_GOODS");
// data.put("buyer_nick", "liweiyi");
// data.put("buyer_message_op", "ne");
// data.put("buyer_message", "不要搞错");
// data.put("seller_memo_op", "like");
// data.put("seller_memo", "7号钟");
data.put("seller_flag", "1");
data.put("page_no", "1");
data.put("page_size", "30");
data.put("refunding", "0");
// data.put("sysid", ""); 传什么参数请咨询客服
data.put("sign", Utils.Sign(data, Config.AppSecret));
// 调用服务API
doHttpRequest(Config.TaoBaoOrderExtListUrl, data);
} catch (Exception ex) {
ex.printStackTrace();
}
}
3. 返回结果
返回结果如下
{
"code":0,
"message":"ok",
"data":{
"total":3,
"items":[
{
"adjust_fee":"0.00",
"alipay_no":"2021100222001152871411937447",
"buyer_area":"福建漳州电信",
"buyer_nick":"咸梅00",
"buyer_obtain_point_fee":0,
"buyer_open_uid":"",
"buyer_rate":false,
"buyer_message":"需要礼盒,谢谢!",
"cod_fee":"0.00",
"cod_status":"NEW_CREATED",
"created":"2021-10-02 16:13:56",
"discount_fee":"8.42",
"paid_coupon_fee":"",
"order_tax_fee":"",
"credit_card_fee":"",
"coupon_fee":0,
"is_brand_sale":false,
"is_force_wlb":false,
"is_lgtype":false,
"modified":"2021-10-02 16:17:42",
"new_presell":false,
"num":1,
"num_iid":613373384956,
"orders":{
"order":[
{
"adjust_fee":"0.00",
"buyer_rate":false,
"cid":50012772,
"discount_fee":"24.00",
"divide_order_fee":"105.58",
"is_daixiao":false,
"is_oversold":false,
"nr_outer_iid":"",
"num":1,
"num_iid":613373384956,
"oid":"1410072240792463390",
"oid_str":"",
"order_from":"WAP,WAP",
"outer_iid":"",
"outer_sku_id":"",
"payment":"105.58",
"pic_path":"https://img.alicdn.com/bao/uploaded/i1/1820950890/O1CN01Ntkavy1IRf5SUyYyQ_!!1820950890.jpg",
"price":"138.00",
"refund_status":"SUCCESS",
"seller_rate":false,
"seller_type":"C",
"sku_id":"4490318210144",
"sku_properties_name":"颜色分类:豆沙色;尺码:L",
"snapshot_url":"u:1410072240792463390_1",
"status":"TRADE_CLOSED",
"title":"冰丝绸睡衣女春夏蕾丝花边性感丝滑星星仿真丝超薄开衫长袖家居服",
"total_fee":"114.00",
"invoice_no":"",
"logistics_company":"",
"part_mjz_discount":"8.42",
"fqg_num":0,
"is_fqg_s_fee":false,
"recharge_fee":"",
"credit_buy":"",
"consign_time":"",
"modified":"",
"refund_id":"89670685480469033",
"end_time":"2021-10-02 16:16:15",
"shipping_type":""
}
]
},
"pay_time":"2021-10-02 16:13:59",
"payment":"105.58",
"pic_path":"https://img.alicdn.com/bao/uploaded/i1/1820950890/O1CN01Ntkavy1IRf5SUyYyQ_!!1820950890.jpg",
"point_fee":0,
"post_fee":"0.00",
"price":"138.00",
"real_point_fee":0,
"received_payment":"0.00",
"receiver_address":"云*镇**路***号凯盛通讯",
"receiver_city":"漳州市",
"receiver_district":"云霄县",
"receiver_town":"云陵镇",
"receiver_mobile":"*******1889",
"receiver_phone":"",
"receiver_name":"丽**",
"receiver_state":"福建省",
"receiver_zip":"000000",
"seller_flag":1,
"seller_memo":"礼盒",
"seller_nick":"可拆卸aa",
"seller_rate":false,
"shipping_type":"express",
"status":"TRADE_CLOSED",
"tid":"1410072240792463390",
"tid_str":"1410072240792463390",
"title":"SUN因家而生",
"total_fee":"138.00",
"type":"fixed",
"you_xiang":false,
"trade_from":"WAP,WAP",
"app_name":"",
"oaid":"1Xic30TPmr9x7w6kdCia5YEjRsOSSZ6Ghicwp4fmw6fqkkTQQq0x1OwRIibM8kcr8n9CZ2ockH",
"consign_time":"",
"has_post_fee":true,
"timeout_action_time":"",
"snapshot_url":"u:1410072240792463390_1",
"end_time":"2021-10-02 16:16:15",
"platform_subsidy_fee":"",
"rx_audit_status":""
},
{
"adjust_fee":"0.00",
"alipay_no":"2021100622001149491452413837",
"buyer_area":"",
"buyer_nick":"tb446831190",
"buyer_obtain_point_fee":0,
"buyer_open_uid":"",
"buyer_rate":false,
"buyer_message":"",
"cod_fee":"0.00",
"cod_status":"NEW_CREATED",
"created":"2021-10-06 15:19:37",
"discount_fee":"38.16",
"paid_coupon_fee":"",
"order_tax_fee":"",
"credit_card_fee":"",
"coupon_fee":0,
"is_brand_sale":false,
"is_force_wlb":false,
"is_lgtype":false,
"modified":"2021-10-07 19:22:29",
"new_presell":false,
"num":1,
"num_iid":627502976336,
"orders":{
"order":[
{
"adjust_fee":"0.00",
"buyer_rate":false,
"cid":50012772,
"discount_fee":"46.00",
"divide_order_fee":"143.84",
"is_daixiao":false,
"is_oversold":false,
"nr_outer_iid":"",
"num":1,
"num_iid":627502976336,
"oid":"2161196210547294406",
"oid_str":"",
"order_from":"WAP,WAP",
"outer_iid":"",
"outer_sku_id":"",
"payment":"143.84",
"pic_path":"https://img.alicdn.com/bao/uploaded/i3/1820950890/O1CN01GveBvz1IRf7ceLHx9_!!1820950890.jpg",
"price":"228.00",
"refund_status":"SUCCESS",
"seller_rate":false,
"seller_type":"C",
"sku_id":"4721825188091",
"sku_properties_name":"颜色分类:三件套【白色樱桃】;尺码:均码有弹力【建议90-145斤】",
"snapshot_url":"u:2161196210547294406_1",
"status":"TRADE_CLOSED",
"title":"软绵绵睡衣女秋冬季长袖长裤吊带三件套加厚V领开衫珊瑚绒家居服",
"total_fee":"182.00",
"invoice_no":"",
"logistics_company":"",
"part_mjz_discount":"38.16",
"fqg_num":0,
"is_fqg_s_fee":false,
"recharge_fee":"",
"credit_buy":"",
"consign_time":"",
"modified":"",
"refund_id":"131819509106290644",
"end_time":"2021-10-07 19:22:30",
"shipping_type":""
}
]
},
"pay_time":"2021-10-06 15:19:56",
"payment":"143.84",
"pic_path":"https://img.alicdn.com/bao/uploaded/i3/1820950890/O1CN01GveBvz1IRf7ceLHx9_!!1820950890.jpg",
"point_fee":0,
"post_fee":"0.00",
"price":"228.00",
"real_point_fee":0,
"received_payment":"0.00",
"receiver_address":"里*乡**县**乡小**村",
"receiver_city":"衡水市",
"receiver_district":"故城县",
"receiver_town":"里老乡",
"receiver_mobile":"*******8101",
"receiver_phone":"",
"receiver_name":"刘**",
"receiver_state":"河北省",
"receiver_zip":"000000",
"seller_flag":1,
"seller_memo":"99.4",
"seller_nick":"可拆卸aa",
"seller_rate":false,
"shipping_type":"express",
"status":"TRADE_CLOSED",
"tid":"2161196210547294406",
"tid_str":"2161196210547294406",
"title":"SUN因家而生",
"total_fee":"228.00",
"type":"fixed",
"you_xiang":false,
"trade_from":"WAP,WAP",
"app_name":"",
"oaid":"1TgzWP3JffNmyL5f6yvQpThguib83ZEia46E0HhzUFavLVlqkZA045IwmJ3jmicBURupx15ug",
"consign_time":"",
"has_post_fee":true,
"timeout_action_time":"",
"snapshot_url":"u:2161196210547294406_1",
"end_time":"2021-10-07 19:22:30",
"platform_subsidy_fee":"",
"rx_audit_status":"",
"buyer_open_uid":"AAEt90gYAAjcqSrFKsJnK_Ba"
}
]
}
}
说明: code为0表示成功,非0为失败,message会包含失败原因。total为符合查询的总记录数,可根据返回的总记录数进行分页查询, data字段包含订单列表的数据, 返回的字段说明见淘宝文档
文档更新时间: 2023-10-10 18:25 作者:admin