WeChat product management


Commodity Management

Product management

Query product information

By calling this interface, merchants can query the successfully created product information to check the product status or information settings.

Request example

HTTP请求方式:POST
https://api.weixin.qq.com/scan/product/get?access_token=access_token
POST数据格式:JSON
POST数据例子:
{
 "keystandard": "ean13",
 "keystr": "6900873042720"
}

Request parameter description

ParameterIs it requiredDescription
access_tokenYesGlobal credentials of the official account, used for interface calls.
keystandard is the product coding standard.
keystr is the product code content.

Return example

The correct JSON return result is as follows:

{
 "errcode": 0,
 "errmsg": "ok",
 "brand_info":{
  "base_info":{
   "title": "扫一扫动态主页demo",
"thumb_url":"http://mmbiz.qpic.cn/mmbiz/AhrnkhhK7rWevHib2pmq1phtply6JicADNrX6Yrvd7LzKERyic3kn3VdSsmFr5F5ibXzj9Al65yWFudmjqcWic1Qe9g/0",
   "brand_tag": "小耿哥8",
   "category_id": 0,
   "retail_price": "0.00",
   "store_mgr_type": "auto",
   "store_vendorid_list":[],
   "color": "auto",
   "status": "on"
  },
  "detail_info":{
   "banner_list":[
{"link":"http://mmbiz.qpic.cn/mmbiz/AhrnkhhK7rWevHib2pmq1phtply6JicADNic0LvlkCw7s6mZpicib7ict5MhoiaL3gPrYXpibnibOpViaYJFpic12nx4bNZcQ/0"},
{"link":"http://mmbiz.qpic.cn/mmbiz/AhrnkhhK7rWevHib2pmq1phtply6JicADNbTfwJmlVXp9k1A80UCFL1a9icwdthmSLh0RuJ5iaKcZBwdXbOicktkwPQ/0"},
{"link":"http://mmbiz.qpic.cn/mmbiz/AhrnkhhK7rWevHib2pmq1phtply6JicADNW4FD74oXjEyqHicE9U3H0nTCdLHibo7rRia2TFBQ6tx2Pvic92ica8Wns4Q/0"}
   ],
   "detail_list":[
    {
     "title": "产品名称",
     "desc": "微信相框moment"
    },
    {
     "title": "设计团队",
     "desc": "微信团队"
    },
    {
     "title": "设计初衷",
     "desc": "做一个简单纯粹的电子相框"
    },
    {
     "title": "产品诉求",
     "desc": "以相框为纽带,增加子女与父母长辈的沟通,用照片通过微信传递感情交流"
    }
   ]
  },
  "action_info":{
   "action_list":[
    {
     "type": "link",
     "name": "banner",
     "link": "http://mp.weixin.qq.com",
"image":"http://mmbiz.qpic.cn/mmbiz/AhrnkhhK7rWevHib2pmq1phtply6JicADNgjXTKn0j4TlfXjUOPYBDicVOmG0sdNfUOg9Lzia2g9cbjyTXmOiaB6L1g/0",
     "showtype": "banner"
    },
    {
     "type": "link",
     "name": "自定义活动1",
     "link": "http://p.url.cn/wxscan.php",
    },
    {
     "type": "link",
     "name": "自定义活动2",
     "link": "http://p.url.cn/wxscan.php",
    },
    {
     "type": "user",
     "appid": "wx307e399609946068"
    },
    {
     "type": "text",
     "text": "此处可根据品牌商需要,用于简单描述商品或活动。"
    }
   ]
  },
  "module_info":{
   "module_list":[
    {
     "type": "anti_fake",
     "native_show": "true"
    }
   ]
  }
 }
}

Return parameter description

ParametersDescription
errcode0 means the call is successful, otherwise the relevant error code will be returned.
errmsgok means the call is successful, otherwise an error message will be returned.
statusThe status of the product homepage, on is the published status, off is the unpublished status, check is the review status, and reject is the review failed status.

For other parameter descriptions, please refer to the "Create Product" interface.

Note: For products whose status is "checking", you cannot call the interface to update or cancel publishing, otherwise an error will be reported.

Query product information in batches

Call this interface, merchants can query and create batches successfully Product information, the query dimensions include product status and coding content.

Request example

HTTP请求方式:POST
https://api.weixin.qq.com/scan/product/getlist?access_token=access_toke
POST数据格式:JSON
POST数据例子:
{
 "offset": "1",
 "limit": "10",
 "status":"on",
}

Request parameter description

ParameterIs it requiredDescription
access_tokenYesGlobal credentials of the official account, used for interface calls.
offset is the starting position of batch query, starting from 0 and including the starting position.
limit is the number of batch queries.
statusNoSupports pulling by status. on is the released status, off is the unpublished status, check is the review status, reject is the review failed status, and all is all status.
keystrNoSupports pulling by partial encoding content. After filling in this parameter, the product information containing the passed parameters in the encoding content can be pulled out. Similar to keyword search.

Return example

The correct JSON return result is as follows:

{
 "errcode": 0,
 "errmsg": "ok",
 "total": 2,
 "key_list": [
  {
   "keystandard": "ean13",
   "keystr": "6390000000000",
   "category_id": 537117576,
   "category_name": "果泥/菜泥/肉泥",
   "update_time": 1413181580,
   "status": "on"
  },
  {
   "keystandard": "ean13",
   "keystr": "6390000000002",
   "category_id": 537117576,
   "category_name": "果泥/菜泥/肉泥",
   "update_time": 1412834605,
   "status": "on"
  }
 ]
}

Return parameter description

##errcode0 means the call is successful, otherwise the relevant error code will be returned. errmsgok means the call is successful, otherwise an error message will be returned. totalThe total number of products that match the filter criteria. key_listProduct information list. keystandardCommodity coding standard. keystrProduct code content. category_id Product category ID. category_name Product category name. update_timeThe last update time of product information (integer type). statusThe status of the product homepage, on is the published status, off is the unpublished status, check is the review status, and reject is the review failed status.

Update product information

Call this interface to update the product’s basic information (base_info), detailed information (detail_info), The four parts of the promotion service area (action_info) and component area (modul_info) are updated independently or as a whole.

Note: When updating products that are in "release status (on)", after successfully calling the interface, the new product information will automatically enter the scan review system. Products that are "in review (checking)" cannot be updated or unpublished, otherwise an error will be reported.

Request example

HTTP请求方式:POST
https://api.weixin.qq.com/scan/product/update?access_token=access_token 
POST数据格式:JSON
POST数据例子:
{
 "keystandard": "ean13",
 "keystr": "6390000000000",
 "brand_info": {
  "action_info": {
   "action_list": [
    {
     "type": "link",
     "name": "banner",
     "link":"http://mp.weixin.qq.com",
"image":"http://mmbiz.qpic.cn/mmbiz/AhrnkhhK7rWevHib2pmq1phtply6JicADNgjXTKn0j4TlfXjUOPYBDicVOmG0sdNfUOg9Lzia2g9cbjyTXmOiaB6L1g/0",
     "showtype": "banner"
    },
    {
     "type": "link",
     "name": "更新的自定义活动1",
     "link": "http://p.url.cn/wxscan.php",
    },
    {
     "type": "link",
     "name": "更新的自定义活动2",
     "link": "http://p.url.cn/wxscan.php",
    },
    {
     "type": "user",
     "appid": "wx307e399609946068"
    },
    {
     "type": "text",
     "text": "此处可根据品牌商需要,用于简单描述商品或活动。"
    }
   ]
  }
 }
}

Request parameter description

Parameters Description
ParameterIs it requiredDescription
access_tokenYesGlobal credentials of the official account, used for interface calls.
keystandard is the product coding standard.
keystr is the product code content.
action_infoNo Product promotion service area information.

详细参数说明,请参考“创建商品”接口。

Return example

The correct JSON return result is as follows:

{
 "errcode": 0,
 "errmsg": "ok",
 "pid": "5g0B4A90aqc"
}

Return parameter description

参数说明
errcode0为调用成功,否则返回相关错误码。
errmsgok为调用成功,否则返回错误提示。
pid转译后的商品id,将直接编入“获取商品二维码接口”返回的二维码内容。

Clear product information

By calling this interface, merchants can clear successfully created product information.

Request example

HTTP请求方式:POST
https://api.weixin.qq.com/scan/product/clear?access_token=access_token 
POST数据格式:JSON
POST数据例子:
{
 "keystandard": "ean13",
 "keystr": "6900873042720"
}

Request example description

ParameterIs it requiredDescription
access_tokenYesGlobal credentials of the official account, used for interface calls.
keystandard is the product coding standard.
keystr is the product code content.

Return example

The correct JSON return result is as follows:

{
 "errcode": 0,
 "errmsg": "ok"
}

Return parameter description

参数说明
errcode0为调用成功,否则返回相关错误码。
errmsgok为调用成功,否则返回错误提示。

Jump URL parameter description

Scenario description:

The user clicks on the product After promoting the Link type link in the service area, the external URL will have four parameters: wxkeystand, wxkeystr, wxticket, and wxextinfo. By checking wxticket, the source and identity information of the accessing user can be confirmed, achieving precise operation.

URL示例:http://p.url.cn/wxscandemo/yangbanjian/fangweilanding?91eddae46161ae26a3e6e928f3c07147=scan&wxkeystandard=qrcode&wxkeystr=cosmetics1&wxticket=azlsdGljdXo4Ymow&wxextinfo=123

Parameter description

ParametersDescription
wxkeystandCommodity coding standard.
wxkeystrProduct code content.
wxticketCertificate parameter that identifies the source. You can exchange the corresponding product information and access user information through the "check wxticket parameter interface". Specially, when a user shares a link, WeChat will clear the wxticket parameter to ensure security.
wxextinfoThe extinfo passed in when calling the "Get Product QR Code Interface" is the identification parameter.

Check wxticket parameters

Call this interface to check the product homepage from which the user is currently accessed, and obtain the information on the front end of the webpage User’s identity information. To ensure the correctness of the scenario, the wxticket parameter is only valid for 20 minutes as a temporary signature. If the validity period is exceeded, the check will fail.

Request example

HTTP请求方式:POST
https://api.weixin.qq.com/scan/scanticket/check?access_token=access_token
POST数据格式:JSON
POST数据例子:
{
 "ticket": " Ym1haDlvNXJqY3Ru1",
}

Request parameter description

ParameterIs it requiredDescription
access_tokenYesGlobal credentials of the official account, used for interface calls.
ticket is the wxticket parameter in the request URL.

Return example

The correct JSON return result is as follows:

{	
 "errcode":0,
 "errmsg":"ok",
 "keystandard":"ean13",
 "keystr":"6901481811083",
 "openid":"otAzGjrS4AYCmeJM1GhEOcHXXTAo",
 "scene":"scan",
 "is_check": false,
 "is_contact": false
}

Return parameter description

##errcode0 means the call is successful, otherwise the relevant error code will be returned. errmsgok means the call is successful, otherwise an error message will be returned. keystandardCommodity coding standard. keystrProduct code content. openidThe openid of the current visitor can uniquely identify the user. sceneThe scene that opens the product homepage, scan means scanning the code, others means other scenes, which may be conversations, collections or friend circles. is_checkWhether the barcode (QR code) has been scanned, true means yes, false means no. is_contactWhether to follow the public account, true means you have followed it, false means you have not followed it.

##Component message

To call this interface, you need to first Set the component content when "creating a product", and then control the display results of the component area through this interface.

Currently, through the "events" pushed by merchants on WeChat, they can obtain the product information queried by scanning the QR code and the items previously set by the merchant "extinfo" content. By verifying with local information, the authenticity of the product queried by the user can be determined, and the results are returned to WeChat through this interface. Finally, WeChat displays the authenticity query results on the client's customized page.

After the merchant sets the component content, the information interaction mode of [User-WeChat-Merchant] is as follows:

Push XML Example

 <xml> 
<ToUserName><![CDATA[gh_fbe8a958756e]]></ToUserName> 
<FromUserName><![CDATA[otAzGjrJVN21mpDF4ZWQiYZwdK0Y]]></FromUserName>
<CreateTime>1447848568</CreateTime> 
<MsgType><![CDATA[event]]></MsgType> 
<Event><![CDATA[scan_product_callback]]></Event> 
<KeyStandard><![CDATA[qrcode]]></KeyStandard> 
<KeyStr><![CDATA[weixin_antifake]]></KeyStr> 
<ExtInfo><![CDATA[hyhy]]></ExtInfo> 
<NeedAntiFake>true</NeedAntiFake> 
</xml>

Push parameter description

Parameters Description
ParametersDescription
ToUserNameThe original id of the merchant’s public account.
FromUserNameThe user’s openid.
CreateTimeMessage creation time (integer).
MsgTypeMessage type, event.
EventEvent type, scan_product_callback is the component message event.
KeyStandardCommodity coding standard.
KeyStrProduct code content.
ExtInfoThe extinfo passed in when calling the "Get Product QR Code Interface" is the identification parameter.
NeedAntiFake Please use the pop-up page provided by WeChat to display the anti-counterfeiting results. True means used, false means not used.

Return XML example

 <xml> 
<ToUserName><![CDATA[otAzGjrJVN21mpDF4ZWQiYZwdK0Y]]></ToUserName> 
<FromUserName><![CDATA[gh_fbe8a958756e]]></FromUserName>
<CreateTime>1447848568</CreateTime> 
<MsgType><![CDATA[scanproduct]]></MsgType> 
<ScanProduct> 
<KeyStandard><![CDATA[qrcode]]></KeyStandard> 
<KeyStr><![CDATA[weixin_antifake]]></KeyStr> 
<ExtInfo><![CDATA[hyhy]]></ExtInfo> 
<AntiFake> 
<CodeResult><![CDATA[real]]></CodeResult> 
</AntiFake> 
</ScanProduct>
</xml>

Return parameter description

ParametersDescription
ToUserNameThe openid of the user.
FromUserNameThe original ID of the merchant’s public account.
CreateTimeMessage creation time (integer).
MsgTypeMessage type, scanproduct.
KeyStandardCommodity coding standard.
KeyStrProduct code content.
ExtInfoThe extinfo passed in when calling the "Get Product QR Code Interface" is the identification parameter.
AntiFakeContent of anti-counterfeiting information.
CodeResultThe result of product anti-counterfeiting query, real means the code is true, fake means the code is false, and not_active means the anti-counterfeiting code is not activated.

Clear scan code records

When the "native anti-counterfeiting component" is set on the product homepage (for details, please see [ Create a product]), every time a user scans the QR code to view the homepage, it will be counted and then displayed in the "Anti-Counterfeiting Query Details". If the merchant wants to "reset" the scanned records of a certain code to zero, it can call this interface to clear the scanned records of the code.

Request example

HTTP请求方式:POST
https://api.weixin.qq.com/scan/scanticket/check?access_token=access_token
POST数据格式:JSON
POST数据例子:
{
 "keystandard": "ean13",
 "keystr": "6900000000000",
 "extinfo":"extinfo"
}

Request parameter description

ParameterIs it requiredDescription
access_tokenYesGlobal credentials of the official account, used for interface calls.
keystandard is the product coding standard.
keystr is the product code content.
extinfo is the extinfo passed in when calls the "Get Product QR Code Interface" and is the identification parameter.

Return example

The correct JSON return result is as follows:

{	
 "errcode":0,
 "errmsg":"ok"
}

Return parameter description

参数说明
errcode0为调用成功,否则返回相关错误码。
errmsgok为调用成功,否则返回错误提示。