跳转到内容
返回官网

获取商品详情

微信小店

微信小店获取商品详情

一、接口名称

  • 接口地址:https://kf.fw199.com/gateway/wxstore/product/detail

  • 请求方式:POST

  • Content-Type:application/x-www-form-urlencoded

  • 字段说明参考:微信官方 · 获取货品详情

支持单个或批量查询商品详情。product_id 多个时用英文逗号分隔,最多 50 个;费用 = 单价 × 商品数量。多个商品并发请求上游,结果合并返回。

二、请求参数

公共参数

参数名类型是否必需说明
appidstring必需开发者 appid
timestampstring必需时间戳(秒)
signstring必需参数签名,算法见蜂巢接入指南

业务参数

参数名类型是否必需说明
seller_nickstring必需微信小店店铺 ownerId / username(订单宝授权店铺标识)
sysidstring固定传 `550`(微信小店订单宝)
product_idstring必需商品 ID;多个用英文逗号分隔,最多 50 个,如 `10000334316,10000334317`
data_typestring数据类型,默认 `1`。`1` 线上数据,`2` 草稿数据,`3` 同时获取线上和草稿

三、请求示例代码

Java

三(一)、查询单个商品

@Test
public void wxstoreProductDetail() throws Exception {
String apiUrl = "https://kf.fw199.com/gateway/wxstore/product/detail";
Map<String, String> data = new HashMap<>();
data.put("appid", Config.AppId);
Long timestamp = System.currentTimeMillis() / 1000;
data.put("timestamp", timestamp.toString());
data.put("seller_nick", "your_owner_id");
data.put("sysid", "550");
data.put("product_id", "10000741839533");
data.put("data_type", "1");
data.put("sign", Utils.Sign(data, Config.AppSecret));
String result = doHttpRequest(apiUrl, data);
System.out.println("result:" + result);
}

三(二)、批量查询多个商品

@Test
public void wxstoreProductDetailBatch() throws Exception {
String apiUrl = "https://kf.fw199.com/gateway/wxstore/product/detail";
Map<String, String> data = new HashMap<>();
data.put("appid", Config.AppId);
Long timestamp = System.currentTimeMillis() / 1000;
data.put("timestamp", timestamp.toString());
data.put("seller_nick", "your_owner_id");
data.put("sysid", "550");
data.put("product_id", "10000741839533,10001260878553");
data.put("data_type", "1");
data.put("sign", Utils.Sign(data, Config.AppSecret));
String result = doHttpRequest(apiUrl, data);
System.out.println("result:" + result);
}

四、返回结果

说明:最外层 code0 表示蜂巢接口调用成功。无论查询 1 个还是多个商品,统一返回 product_details 数组,仅条数不同。单个商品失败不会导致整单失败,失败信息体现在对应条目的 code / message 中。

四(一)、成功示例

{
"code": 0,
"message": "ok",
"data": {
"product_details": [
{
"code": 10000,
"message": "获取成功",
"product": {
"after_sale_info": {
"after_sale_address_id": "85809032002"
},
"aftersale_desc": "",
"attrs": [
{
"attr_key": "材质",
"attr_value": "TPR(热塑性橡胶)"
}
],
"blind_box_info": {
"blind_box_series_id": "0",
"blind_box_type": 0,
"out_series_id": ""
},
"brand_id": "2100000000",
"cats": [
{
"cat_id": "1653"
},
{
"cat_id": "1654"
},
{
"cat_id": "545665"
}
],
"cats_v2": [
{
"cat_id": "10000066"
},
{
"cat_id": "10000067"
},
{
"cat_id": "10000464"
},
{
"cat_id": "545665"
}
],
"custom_config": {
"custom_text_color": "",
"custom_text_direction": 0,
"custom_text_font_size": 0,
"custom_text_input_type": 0,
"custom_text_input_types": [],
"custom_text_max_length": 0,
"custom_type": [],
"delivery_time": 0,
"desc_img_list": [],
"open_custom": false,
"preview_type": 0
},
"deliver_acct_type": [],
"deliver_method": 0,
"desc_info": {
"desc": "舒适透气男士夏季凉拖",
"imgs": [
"https://mmecimage.cn/p/wx9acf39d4f153ceb8/y2jX8tgVJTCvk3ByRt4H7w"
]
},
"domain_type": 0,
"edit_time": 0,
"express_info": {
"express_type": 0,
"template_id": "891256776004",
"weight": 0
},
"extra_service": {
"damage_guarantee": 0,
"exchange_support": 1,
"fake_one_pay_three": 0,
"freight_insurance": 0,
"pay_after_use": 0,
"seven_day_return": 1
},
"head_imgs": [
"https://mmecimage.cn/p/wx9acf39d4f153ceb8/OFzIiUS1rSGcpNOr_RqzTg",
"https://mmecimage.cn/p/wx9acf39d4f153ceb8/U1wg_V3nmM0prBrppXZjoA",
"https://mmecimage.cn/p/wx9acf39d4f153ceb8/NVn_Xv2sQVX0iOvuLcXvAg"
],
"head_videos": [],
"hide_in_window": 0,
"limited_info": {
"limited_buy_num": 0,
"period_type": 0
},
"min_price": 3000,
"out_product_id": "",
"product_id": "10000741839533",
"product_qua_infos": [
{
"qua_id": "50000043",
"qua_url": []
},
{
"qua_id": "50000074",
"qua_url": []
},
{
"qua_id": "50000044",
"qua_url": []
},
{
"qua_id": "1111491",
"qua_url": []
},
{
"qua_id": "1111496",
"qua_url": []
}
],
"product_type": 1,
"qualifications": [],
"release_mode": 0,
"short_title": "舒适透气男士夏季凉拖",
"size_chart": {
"enable": false,
"specification_list": []
},
"skus": [
{
"bar_code": "",
"out_sku_id": "",
"sale_price": 3000,
"sku_attrs": [
{
"attr_key": "颜色",
"attr_value": "白色"
},
{
"attr_key": "大小",
"attr_value": "42"
}
],
"sku_code": "skuwt42",
"sku_deliver_info": {
"full_payment_presale_delivery_time": 0,
"full_payment_presale_delivery_type": 0,
"presale_begin_time": 0,
"presale_end_time": 0,
"spot_after_presale_end": 0,
"stock_type": 0
},
"sku_id": "22888539681",
"status": 5,
"stock_num": 3,
"thumb_img": ""
},
{
"bar_code": "",
"out_sku_id": "",
"sale_price": 3000,
"sku_attrs": [
{
"attr_key": "颜色",
"attr_value": "白色"
},
{
"attr_key": "大小",
"attr_value": "43"
}
],
"sku_code": "skuwt43",
"sku_deliver_info": {
"full_payment_presale_delivery_time": 0,
"full_payment_presale_delivery_type": 0,
"presale_begin_time": 0,
"presale_end_time": 0,
"spot_after_presale_end": 0,
"stock_type": 0
},
"sku_id": "22888971503",
"status": 5,
"stock_num": 3,
"thumb_img": ""
},
{
"bar_code": "",
"out_sku_id": "",
"sale_price": 3000,
"sku_attrs": [
{
"attr_key": "颜色",
"attr_value": "黑色"
},
{
"attr_key": "大小",
"attr_value": "42"
}
],
"sku_code": "skubk42",
"sku_deliver_info": {
"full_payment_presale_delivery_time": 0,
"full_payment_presale_delivery_type": 0,
"presale_begin_time": 0,
"presale_end_time": 0,
"spot_after_presale_end": 0,
"stock_type": 0
},
"sku_id": "22888981997",
"status": 5,
"stock_num": 3,
"thumb_img": ""
},
{
"bar_code": "",
"out_sku_id": "",
"sale_price": 3000,
"sku_attrs": [
{
"attr_key": "颜色",
"attr_value": "黑色"
},
{
"attr_key": "大小",
"attr_value": "43"
}
],
"sku_code": "skubk43",
"sku_deliver_info": {
"full_payment_presale_delivery_time": 0,
"full_payment_presale_delivery_type": 0,
"presale_begin_time": 0,
"presale_end_time": 0,
"spot_after_presale_end": 0,
"stock_type": 0
},
"sku_id": "22888971504",
"status": 5,
"stock_num": 3,
"thumb_img": ""
}
],
"spu_code": "productcode001",
"spu_deliver_info": {
"is_spu_range": 0,
"sku_deliver_info": {
"full_payment_presale_delivery_time": 0,
"full_payment_presale_delivery_type": 0,
"presale_begin_time": 0,
"presale_end_time": 0,
"spot_after_presale_end": 0,
"stock_type": 1
}
},
"status": 5,
"sub_status": 0,
"sub_title": "",
"title": "夏天男士凉拖",
"total_sold_num": 1,
"vertical_head_imgs": [],
"white_bg_imgs": []
},
"product_id": "10000741839533"
},
{
"code": 10000,
"message": "获取成功",
"product": {
"after_sale_info": {
"after_sale_address_id": "85809032002"
},
"aftersale_desc": "",
"attrs": [
{
"attr_key": "材质",
"attr_value": "陶瓷"
},
{
"attr_key": "规格",
"attr_value": "中杯"
},
{
"attr_key": "适用人群",
"attr_value": "通用"
},
{
"attr_key": "内胆材质",
"attr_value": "无过滤"
},
{
"attr_key": "产地",
"attr_value": "上海"
},
{
"attr_key": "容量",
"attr_value": "330 ml"
},
{
"attr_key": "是否手工",
"attr_value": ""
},
{
"attr_key": "是否具有拍卖/收藏价值",
"attr_value": "不具有"
},
{
"attr_key": "是否批量生产(孤品)",
"attr_value": "批量生产"
}
],
"blind_box_info": {
"blind_box_series_id": "0",
"blind_box_type": 0,
"out_series_id": ""
},
"brand_id": "2100000000",
"cats": [
{
"cat_id": "1142"
},
{
"cat_id": "1169"
},
{
"cat_id": "546607"
}
],
"cats_v2": [
{
"cat_id": "10000018"
},
{
"cat_id": "10000022"
},
{
"cat_id": "10000586"
},
{
"cat_id": "546607"
}
],
"custom_config": {
"custom_text_input_types": [],
"custom_type": [],
"desc_img_list": []
},
"deliver_acct_type": [],
"deliver_method": 0,
"desc_info": {
"desc": "",
"imgs": [
"https://mmecimage.cn/p/wx9acf39d4f153ceb8/x4IbvC8YytUN8gWC_b8lSg"
]
},
"domain_type": 0,
"edit_time": 0,
"express_info": {
"express_type": 0,
"template_id": "891256776004",
"weight": 0
},
"extra_service": {
"damage_guarantee": 0,
"exchange_support": 1,
"fake_one_pay_three": 0,
"freight_insurance": 0,
"pay_after_use": 0,
"seven_day_return": 1
},
"head_imgs": [
"https://mmecimage.cn/p/wx9acf39d4f153ceb8/-cxT_HaitHArerBCnN4vJQ",
"https://mmecimage.cn/p/wx9acf39d4f153ceb8/hVowYGyAgEroQHr3jNatDg",
"https://mmecimage.cn/p/wx9acf39d4f153ceb8/H0M9WNGNyiAFiHBvesE0HQ"
],
"head_videos": [],
"hide_in_window": 0,
"limited_info": {
"limited_buy_num": 0,
"period_type": 0
},
"min_price": 5000,
"out_product_id": "",
"product_id": "10001260878553",
"product_qua_infos": [
{
"qua_id": "1111491",
"qua_url": []
},
{
"qua_id": "1111496",
"qua_url": []
},
{
"qua_id": "1111510",
"qua_url": []
}
],
"product_type": 1,
"qualifications": [],
"release_mode": 0,
"short_title": "简约高级羊脂玉瓷马克杯",
"size_chart": {
"enable": false,
"specification_list": []
},
"skus": [
{
"bar_code": "",
"out_sku_id": "",
"sale_price": 5000,
"sku_attrs": [],
"sku_code": "skushuibei99",
"sku_deliver_info": {
"full_payment_presale_delivery_time": 0,
"full_payment_presale_delivery_type": 0,
"presale_begin_time": 0,
"presale_end_time": 0,
"spot_after_presale_end": 0,
"stock_type": 0
},
"sku_id": "22889662302",
"status": 5,
"stock_num": 1,
"thumb_img": ""
}
],
"spu_code": "pcode982",
"spu_deliver_info": {
"is_spu_range": 0,
"sku_deliver_info": {
"full_payment_presale_delivery_time": 0,
"full_payment_presale_delivery_type": 0,
"presale_begin_time": 0,
"presale_end_time": 0,
"spot_after_presale_end": 0,
"stock_type": 1
}
},
"status": 5,
"sub_status": 0,
"sub_title": "",
"timing_onsale_info": {
"is_hide_price": 0,
"onsale_time": 0,
"status": 0
},
"title": "羊脂玉瓷马克杯大容量简约高级感办公室家用白色400ml茶杯水杯",
"total_sold_num": 0,
"vertical_head_imgs": [
"https://mmecimage.cn/p/wx9acf39d4f153ceb8/B9tuXEkZnrp4dRHlR9VU_Q"
],
"white_bg_imgs": [
"https://mmecimage.cn/p/wx9acf39d4f153ceb8/Lh2p9WFkAZxtrIBThVdg6w"
]
},
"product_id": "10001260878553"
}
]
},
"trace_id": "77e78135-3072-4f1c-8ffc-ecf72a554b55"
}

四(二)、成功示例

批量查询

{
"code": 0,
"message": "ok",
"data": {
"product_details": [
{
"product_id": "10000741839533",
"code": 10000,
"message": "获取成功",
"product": { }
},
{
"product_id": "10001260878553",
"code": 10000,
"message": "获取成功",
"product": { }
}
]
},
"trace_id": "c2a79915-4017-44eb-92b4-0d0dcc509f17"
}

product 对象字段较多,完整结构请参考微信官方货品详情文档