搜索当前会话用户作为卖家已卖出的交易数据(只能获取到三个月以内的交易信息)
1. 返回的数据结果是以订单的创建时间倒序排列的。
2. 返回的数据结果只包含了订单的部分数据,可通过taobao.trade.fullinfo.get获取订单详情。
注意:type字段的说明,如果该字段不传,接口默认只查4种类型订单,其他非默认查询的订单需要在type加上对应订单类型才能返回。
点击查看更多交易API说明
| 名称 | 类型 | 是否必须 | 示例值 | 更多限制 | 描述 |
|---|---|---|---|---|---|
|
fields
|
String | 必须 | tid,type,status,payment,orders,rx_audit_status | 需要返回的字段列表,多个字段用半角逗号分隔,可选值为返回示例中能看到的所有字段。rx_audit_status=0,处方药未审核 | |
| start_created | Date | 可选 | 2000-01-01 00:00:00 | 查询三个月内交易创建时间开始。格式:yyyy-MM-dd HH:mm:ss | |
| end_created | Date | 可选 | 2000-01-01 23:59:59 | 查询交易创建时间结束。格式:yyyy-MM-dd HH:mm:ss | |
| status | String | 可选 | ALL_WAIT_PAY | 交易状态(查看可选值),默认查询所有交易状态的数据,除了默认值外每次只能查询一种状态。 | |
| buyer_nick | String | 可选 | zhangsan | 买家昵称 | |
| type | String | 可选 | game_equipment | 交易类型列表,同时查询多种交易类型可用逗号分隔。默认同时查询guarantee_trade,auto_delivery,ec,cod,step 这5 种的交易类型的数据;查询所有交易类型的数据,需要设置下面全部可选值。可选值:fixed(一口价)auction(拍卖)guarantee_trade(一口价、拍卖)step(分阶段付款,万人团,阶梯团订单)independent_simple_trade(旺店入门版交易)independent_shop_trade(旺店标准版交易)auto_delivery(自动发货)ec(直冲)cod(货到付款)game_equipment(游戏装备)shopex_trade(ShopEX交易)netcn_trade(万网交易)external_trade(统一外部交易)instant_trade (即时到账)b2c_cod(大商家货到付款)hotel_trade(酒店类型交易)super_market_trade(商超交易)super_market_cod_trade(商超货到付款交易)taohua(淘花网交易类型)waimai(外卖交易类型)o2o_offlinetrade(O2O交易)nopaid(即时到帐/趣味猜交易类型)step (万人团) eticket(电子凭证) tmall_i18n(天猫国际);nopaid (无付款交易)insurance_plus(保险)finance(基金)注:guarantee_trade是一个组合查询条件,并不是一种交易类型,获取批量或单个订单中不会返回此种类型的订单。pre_auth_type(预授权0元购) lazada(获取lazada订单类型) | |
| ext_type | String | 可选 | service | 可选值有ershou(二手市场的订单),service(商城服务子订单)mark(双十一大促活动异常订单)作为扩展类型筛选只能做单个ext_type查询,不能全部查询所有的ext_type类型 | |
| rate_status | String | 可选 | RATE_UNBUYER |
评价状态,默认查询所有评价状态的数据,除了默认值外每次只能查询一种状态。 可选值:RATE_UNBUYER(买家未评)RATE_UNSELLER(卖家未评)RATE_BUYER_UNSELLER(买家已评,卖家未评)RATE_UNBUYER_SELLER(买家未评,卖家已评)RATE_BUYER_SELLER(买家已评,卖家已评) |
|
| tag | String | 可选 | time_card | 卖家对交易的自定义分组标签,目前可选值为:time_card(点卡软件代充),fee_card(话费软件代充) | |
| page_no | Number | 可选 | 1 |
|
页码。默认值:1,可填整数,通过传入page_no来控制获取的页数,总页数=total_results÷page_size |
| page_size | Number | 可选 | 40 |
|
每页条数。 默认值:40;最大值:100,可填整数。通过page_no和page_size组合多次调用实现翻页获取全量数据。 |
| use_has_next | Boolean | 可选 | true |
|
是否启用has_next的分页方式,如果指定true,则返回的结果中不包含总记录数,但是会新增一个是否存在下一页的的字段,通过此种方式获取增量交易,接口调用成功率在原有的基础上有所提升。 |
| buyer_open_id | String | 可选 | AAHm5d-EAAeGwJedwSHpg8bT | 买家的openId |
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| total_results | Number | 100 | 搜索到的交易信息总数 |
| trades | Trade [] | 搜索到的交易信息列表,返回的Trade和Order中包含的具体信息为入参fields请求的字段信息 | |
|
|||
| has_next | Boolean | true | 是否存在下一页 |
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
TradesSoldGetRequest req = new TradesSoldGetRequest();
req.setFields("tid,type,status,payment,orders,rx_audit_status");
req.setStartCreated(StringUtils.parseDateTime("2000-01-01 00:00:00"));
req.setEndCreated(StringUtils.parseDateTime("2000-01-01 23:59:59"));
req.setStatus("ALL_WAIT_PAY");
req.setBuyerNick("zhangsan");
req.setType("game_equipment");
req.setExtType("service");
req.setRateStatus("RATE_UNBUYER");
req.setTag("time_card");
req.setPageNo(1L);
req.setPageSize(40L);
req.setUseHasNext(true);
req.setBuyerOpenId("AAHm5d-EAAeGwJedwSHpg8bT");
TradesSoldGetResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
<trades_sold_get_response>
<total_results>100</total_results>
<trades>
<trade>
<seller_nick>我在测试</seller_nick>
<buyer_open_uid>AAHk5d-EAAeGwJedwSFu0XXX</buyer_open_uid>
<title>麦包包</title>
<type>fixed(一口价)</type>
<created>2000-01-01 00:00:00</created>
<tid>2231958349</tid>
<acookie_id>1a11a0987628772c002ec7d0eec2a352</acookie_id>
<sid>NP1021246146</sid>
<seller_rate>true</seller_rate>
<buyer_rate>true</buyer_rate>
<status>TRADE_NO_CREATE_PAY</status>
<payment>200.07</payment>
<discount_fee>200.07</discount_fee>
<adjust_fee>200.07</adjust_fee>
<post_fee>200.07</post_fee>
<total_fee>200.07</total_fee>
<pay_time>2000-01-01 00:00:00</pay_time>
<end_time>2000-01-01 00:00:00</end_time>
<modified>2000-01-01 00:00:00</modified>
<async_modified>2000-01-01 00:00:00</async_modified>
<consign_time>2000-01-01 00:00:00</consign_time>
<received_payment>200.07</received_payment>
<commission_fee>200.07</commission_fee>
<alipay_no>2009112081173831</alipay_no>
<alipay_id>2011082299567459</alipay_id>
<buyer_area>浙江省杭州市</buyer_area>
<nut_feature>;buyernick:tester;card:123;buyerArea:杭州</nut_feature>
<pic_path>http://img08.taobao.net/bao/uploaded/i8/T1jVXXXePbXXaoPB6a_091917.jpg</pic_path>
<num_iid>3424234</num_iid>
<price>200.07</price>
<cod_fee>12.07</cod_fee>
<cod_status>EW_CREATED(订单已创建)</cod_status>
<shipping_type>free</shipping_type>
<num>1</num>
<point_fee>0</point_fee>
<real_point_fee>0</real_point_fee>
<buyer_obtain_point_fee>0</buyer_obtain_point_fee>
<receiver_name>****东方</receiver_name>
<receiver_state>浙江省</receiver_state>
<receiver_city>杭州市</receiver_city>
<receiver_district>西湖区</receiver_district>
<receiver_town>三墎镇</receiver_town>
<receiver_address>****淘宝城</receiver_address>
<receiver_zip>223700</receiver_zip>
<receiver_mobile>****1826</receiver_mobile>
<receiver_phone>****5372</receiver_phone>
<seller_flag>1</seller_flag>
<is_lgtype>true</is_lgtype>
<lg_aging_type>次日达</lg_aging_type>
<lg_aging>2012-06-19 15:16:14</lg_aging>
<is_brand_sale>true</is_brand_sale>
<is_force_wlb>true</is_force_wlb>
<has_buyer_message>true</has_buyer_message>
<credit_card_fee>30.5</credit_card_fee>
<trade_from>WAP,JHS</trade_from>
<step_trade_status>FRONT_NOPAID_FINAL_NOPAID</step_trade_status>
<step_paid_fee>525.70</step_paid_fee>
<mark_desc>该订单需要延长收货时间</mark_desc>
<has_yfx>true</has_yfx>
<yfx_fee>0.50</yfx_fee>
<yfx_id>135751716473138</yfx_id>
<yfx_type>taojinbi</yfx_type>
<trade_source>ownshop</trade_source>
<send_time>2000-01-01</send_time>
<seller_can_rate>true</seller_can_rate>
<is_part_consign>true</is_part_consign>
<is_wt>true</is_wt>
<is_daixiao>true</is_daixiao>
<o2o>crm</o2o>
<o2o_guide_id>123456</o2o_guide_id>
<o2o_guide_name>西湖门店导购员1</o2o_guide_name>
<o2o_shop_id>123456</o2o_shop_id>
<o2o_shop_name>西湖门店</o2o_shop_name>
<o2o_delivery>inshop</o2o_delivery>
<o2o_out_trade_id>123456</o2o_out_trade_id>
<orders>
<order>
<title>山寨版测试机器</title>
<pic_path>http://img08.taobao.net/bao/uploaded/i8/T1jVXXXePbXXaoPB6a_091917.jpg</pic_path>
<price>200.07</price>
<num_iid>2342344</num_iid>
<sku_id>5937146</sku_id>
<outer_iid>152e442aefe88dd41cb0879232c0dcb0</outer_iid>
<outer_sku_id>81893848</outer_sku_id>
<refund_status>SUCCESS(退款成功)</refund_status>
<status>TRADE_NO_CREATE_PAY</status>
<oid>2231958349</oid>
<total_fee>200.07</total_fee>
<payment>200.07</payment>
<discount_fee>200.07</discount_fee>
<adjust_fee>1.01</adjust_fee>
<divide_order_fee>21.00</divide_order_fee>
<part_mjz_discount>21.00</part_mjz_discount>
<sku_properties_name>颜色:桔色;尺码:M</sku_properties_name>
<item_meal_id>2564854632</item_meal_id>
<item_meal_name>M8原装电池:便携支架:M8专用座充:莫凡保护袋</item_meal_name>
<num>1</num>
<buyer_rate>true</buyer_rate>
<seller_rate>true</seller_rate>
<refund_id>2231958349</refund_id>
<seller_type>B(商城商家)</seller_type>
<cid>123456</cid>
<end_time>2012-04-07 00:00:00</end_time>
<consign_time>2013-01-13 15:23:00</consign_time>
<shipping_type>post</shipping_type>
<logistics_company>顺风快递</logistics_company>
<invoice_no>05432465</invoice_no>
<bind_oid>23194074143138</bind_oid>
<is_daixiao>true</is_daixiao>
<ticket_outer_id>123456abcd</ticket_outer_id>
<ticket_expdate_key>100FFFFFF02374020000002001020304000A</ticket_expdate_key>
<is_www>true</is_www>
<store_code>南京QDHEWL-0004</store_code>
<tmser_spu_code>家装干支装服务</tmser_spu_code>
<sub_order_tax_fee>0</sub_order_tax_fee>
<sub_order_tax_rate>0</sub_order_tax_rate>
<zhengji_status>1</zhengji_status>
<md_qualification>true_access</md_qualification>
<md_fee>999</md_fee>
<sub_order_tax_promotion_fee>0</sub_order_tax_promotion_fee>
<tax_free>true</tax_free>
<tax_coupon_discount>0</tax_coupon_discount>
<special_refund_type>priceProtect</special_refund_type>
<is_devalue_fee>true</is_devalue_fee>
<is_idle>1</is_idle>
<promise_collect_time>2000-01-01 00:00:00</promise_collect_time>
<is_force_dc>true</is_force_dc>
<shp_info>
<ship_info>
<transport_type>express,seller,instant等</transport_type>
</ship_info>
</shp_info>
<qn_distr>1</qn_distr>
<superlink_platform_sub_order_id>4501036620074019938</superlink_platform_sub_order_id>
<superlink_order_supply_price>1.00</superlink_order_supply_price>
</order>
</orders>
<service_orders>
<service_order>
<oid>110770592823138</oid>
<item_oid>110770592803138</item_oid>
<service_id>2342344</service_id>
<service_detail_url>http://wt.taobao.com/plan.htm?plan_id=planId</service_detail_url>
<num>1</num>
<price>39.09</price>
<payment>29.98</payment>
<title>滚筒洗衣机</title>
<total_fee>39.09</total_fee>
<buyer_nick>小倩2005</buyer_nick>
<refund_id>2231958349</refund_id>
<seller_nick>麦包包</seller_nick>
<pic_path>http://img08.taobao.com/bao/upload/i8/T1jVXXXePb_a0908.jpg</pic_path>
<tmser_spu_code>家装干支装服务</tmser_spu_code>
</service_order>
</service_orders>
<zero_purchase>true</zero_purchase>
<receiver_country>中国</receiver_country>
<order_tax_fee>0</order_tax_fee>
<shop_pick>1</shop_pick>
<rx_audit_status>0</rx_audit_status>
<post_gate_declare>true</post_gate_declare>
<cross_bonded_declare>true</cross_bonded_declare>
<order_tax_promotion_fee>0</order_tax_promotion_fee>
<service_type>timedd,jiaju</service_type>
<is_o2o_passport>true</is_o2o_passport>
<tmall_delivery>true</tmall_delivery>
<threepl_timing>true</threepl_timing>
<cn_service>84_50</cn_service>
<cutoff_minutes>660</cutoff_minutes>
<es_time>4</es_time>
<delivery_time>2018-06-09 12:13:14</delivery_time>
<collect_time>2018-06-09 12:13:14</collect_time>
<dispatch_time>2018-06-09 12:13:14</dispatch_time>
<sign_time>2018-06-09 12:13:14</sign_time>
<delivery_cps>STO</delivery_cps>
<es_range>09:00-12:00</es_range>
<es_date>2018-06-09</es_date>
<os_range>09:00-12:00</os_range>
<os_date>2018-06-09</os_date>
<asdp_biz_type>logistics_upgrade</asdp_biz_type>
<asdp_ads>201</asdp_ads>
<drug_register>1</drug_register>
<promise_sign_time>2000-01-01 00:00:00</promise_sign_time>
<oaid>2w2RYE45iahnF4aiaJ7pHKCJ3Hwnbgnq2PH3AfpQVyWZNHKS9wNgAAOUfCVt9XZMetogNHwc</oaid>
<scenario_group>TXD_B2C_FRESH_HALFDAY</scenario_group>
<is_force_dc>true</is_force_dc>
<buyer_nick>我在测试</buyer_nick>
<logistics_agreement>
<logistics_service_msg>送货上门</logistics_service_msg>
<asdp_biz_type>logistics_upgrade</asdp_biz_type>
<asdp_ads>201</asdp_ads>
<sign_time>2019-04-12 16:00:00</sign_time>
<promise_sign_time>2019-04-12 16:00:00</promise_sign_time>
</logistics_agreement>
<logistics_infos>
<logistics_info>
<biz_delivery_type>0</biz_delivery_type>
<unused_warehouse_error_msg>当前订单在猫淘平台对消费者进行了服务承诺:当日发次日达,建议按照平台要求进行择仓,否则存在赔付风险</unused_warehouse_error_msg>
<unused_delivery_error_msg>当前订单在猫淘平台对消费者进行了服务承诺,建议按照平台要求进行择配,否则存在赔付风险”/“平台建议当前线路您只能选择的配品牌,存在电子面单无法打印风险</unused_delivery_error_msg>
<used_black_delivery_error_msg>平台建议当前线路不要使用您选择的配品牌,存在电子面单无法打印风险</used_black_delivery_error_msg>
<promise_outbound_time>2019-04-12 16:00:00</promise_outbound_time>
<trade_id>1100070860172581613</trade_id>
<sub_trade_id>1100070860173581613</sub_trade_id>
<promise_collect_time>2000-01-01 00:00:00</promise_collect_time>
</logistics_info>
</logistics_infos>
<receipt_type>ITEM</receipt_type>
<seller_flag_tag>红色旗子</seller_flag_tag>
<seller_memo>交易备注</seller_memo>
<real_receiver_open_id>AAEnVKOdAOIduo9TH9hjf-zb</real_receiver_open_id>
<real_receiver_display_nick>这是一个昵称</real_receiver_display_nick>
<post_fee_type>giftprepaid</post_fee_type>
<real_post_fee>11</real_post_fee>
<refund_post_fee>8</refund_post_fee>
<gift_post_fee_role>0</gift_post_fee_role>
<qn_distr>1</qn_distr>
<superlink_payment>1.00</superlink_payment>
<superlink_platform_order_id>4501036620074019938</superlink_platform_order_id>
<superlink_alipay_no>2025101322001157971430494256</superlink_alipay_no>
</trade>
</trades>
<has_next>true</has_next>
</trades_sold_get_response>
<error_response>
<code>50</code>
<msg>Remote service error</msg>
<sub_code>isv.invalid-parameter</sub_code>
<sub_msg>非法参数</sub_msg>
</error_response>
| 错误码 | 错误描述 | 解决方案 |
|---|---|---|
| isv.invalid-parameter:buyer_nick | 参数:buyer_nick无效,格式不对、非法值、越界等 | |
| isv.invalid-parameter:seller_nick | 参数:seller_nick无效,格式不对、非法值、越界等 | |
| isp.remote-service-timeout | API调用远程服务超时 | 1. 每次返回50条以下,时间间隔小于半个小时,这样子设置成功率就会提升。2. 目前淘宝的交易高峰期在上午9:30-11:00,下午14:00-17:00,晚上20:00-22:30,避开这个高峰可以提高成功率。3.使用增量API(taobao.increment.trades.get)可以减少甚至避免超时问题。 |
| isv.trade-service-rejection | 请求被拒绝。 | 可能原因为限流,请不要频繁调用,尽量避开高峰期。 |
| isp.trade-service-readdb-overflow | 数据库限流。 | 请求量较大,请避开高峰期。 |
| isv.trade-service-access-frequency | 服务访问频繁 | 请稍后重试 |
| isv.invalid-parameter:start_created-or-end_created | 不合法的参数 | 创建时间和结束时间不能为空 |
| isv.invalid-parameter:seller-id | 非法的参数 | 卖家ID非法 |
| isp.call-limited | 限流 | 避开限流 |
| isv.invalid-parameter:tag | 非法的参数 | 请检查传入参数 |
| isv.invalid-parameter:type | 非法的参数 | 请检查传入参数 |