Contents
1.1 Querying Product Information
1.2 Querying Product Information in Batch
1.3 Updating Product Information
1.4 Deleting Product Information
1.5 Redirection URL Parameters
1.8 Clearing Code Scanning Record
# Product Management
# Querying Product Information
By calling this API, merchants can query the product information that was successfully created to check the status of the product or the information setting.
Request Example
HTTP request method: POST
https://api.weixin.qq.com/scan/product/get?access_token=access_token
POST data format: JSON
POST data example:
{
"keystandard": "ean13",
"keystr": "6900873042720"
}
Request Parameters
Parameter | Required | Description |
---|---|---|
access_token | Yes | The global certificate of the Official Account, which can be used for the API call. |
keystandard | Yes | Product coding standard |
keystr | Yes | Product coding content |
Response Example
The response JSON packet for a successful request:
{
"errcode": 0,
"errmsg": "ok",
"brand_info":{
"base_info":{
"title": "Scan Dynamic Homepage Demo",
"thumb_url":"http://mmbiz.qpic.cn/mmbiz/AhrnkhhK7rWevHib2pmq1phtply6JicADNrX6Yrvd7LzKERyic3kn3VdSsmFr5F5ibXzj9Al65yWFudmjqcWic1Qe9g/0",
"brand_tag": "Mr. Geng8",
"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": "Product Name",
"desc": "Weixin Photo Framemoment"
},
{
"title": "Design Team",
"desc": "Weixin Team"
},
{
"title": "Design Intention",
"desc": "Make a simple e-frame"
},
{
"title": "Product Demand",
"desc": "Increase the communication and between children and parents via photos decorated by Weixin Photo Frame"
}
]
},
"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": "Custom activity1",
"link": "http://p.url.cn/wxscan.php",
},
{
"type": "link",
"name": "Custom activity2",
"link": "http://p.url.cn/wxscan.php",
},
{
"type": "user",
"appid": "wx307e399609946068"
},
{
"type": "text",
"text": "Add product or activity description here according to the brand owner's demand."
}
]
},
"module_info":{
"module_list":[
{
"type": "anti_fake",
"native_show": "true"
}
]
}
}
}
Response Parameters
Parameter | Description |
---|---|
errcode | 0: Success. Otherwise, relevant error code is returned. |
errmsg | Ok: Success. Otherwise, relevant error message is returned. |
status | The status of the product home page. on: Published; off: unpublished; check: Under review; reject: Rejected. |
For other parameters, refer to homepage.
Note: If the product status (status) is "under review (check)", you cannot call the API to update or cancel the product. Otherwise, an error occurs.
# Querying Product Information in Batch
By calling this API, merchants can query the product information that was successfully created in batch to check the product status, encoded content, and other information.
Request Example
HTTPRequest method: POST
https://api.weixin.qq.com/scan/product/getlist?access_token=access_toke
POST data format: JSON
POST data example:
{
"offset": "1",
"limit": "10",
"status":"on",
}
Request Parameters
Parameter | Required | Description |
---|---|---|
access_token | Yes | The global certificate of the Official Account, which can be used for the API call. |
offset | Yes | The starting position of the batch query, starting from 0, including the starting position. |
limit | Yes | Number of batch queries |
status | No | Fetches products by status. on: Published; off: unpublished; check: Under review; reject: Rejected; all: All of them. |
keystr | No | Fetches product information by part of the code. This is similar to keyword search. After this parameter is entered, you can fetch the product information with the parameters contained in the code. |
Response Example
The response JSON packet for a successful request:
{
"errcode": 0,
"errmsg": "ok",
"total": 2,
"key_list": [
{
"keystandard": "ean13",
"keystr": "6390000000000",
"category_id": 537117576,
"category_name": "Fruit puree/vegetable puree/meat puree",
"update_time": 1413181580,
"status": "on"
},
{
"keystandard": "ean13",
"keystr": "6390000000002",
"category_id": 537117576,
"category_name": "Fruit puree/vegetable puree/meat puree",
"update_time": 1412834605,
"status": "on"
}
]
}
Response Parameters
Parameter | Description |
---|---|
errcode | 0: Success. Otherwise, relevant error code is returned. |
errmsg | Ok: Success. Otherwise, relevant error message is returned. |
total | The total number of products that hit the filter conditions |
key_list | Product information list |
keystandard | Product coding standard |
keystr | Product coding content |
category_id | Product category ID |
category_name | Product category name |
update_time | The last time when the product information was updated (integer) |
status | The status of the product home page. on: Published; off: unpublished; check: Under review; reject: Rejected. |
# Updating Product Information
By calling this API, you can update the basic information (base_info), details (detail_info), service promotion area (action_info) and component area (modul_info) separately or as a whole.
Note: For published (on) products, calling this API will automatically forward the updated product information to the scan review system. Products under review (check) cannot be updated or unpublished. Otherwise, an error occurs.
Request Example
HTTPRequest method: POST
https://api.weixin.qq.com/scan/product/update?access_token=access_token
POST data format: JSON
POST data example:
{
"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": "Updated custom activity1",
"link": "http://p.url.cn/wxscan.php",
},
{
"type": "link",
"name": "Updated custom activity2",
"link": "http://p.url.cn/wxscan.php",
},
{
"type": "user",
"appid": "wx307e399609946068"
},
{
"type": "text",
"text": "Add product or activity description here according to the brand owner's demand."
}
]
}
}
}
Request Parameters
Parameter | Required | Description |
---|---|---|
access_token | Yes | The global certificate of the Official Account, which can be used for the API call. |
keystandard | Yes | Product coding standard |
keystr | Yes | Product coding content |
action_info | No | Product's service promotion area information |
For more information, refer to homepage.
Response Example
The response JSON packet for a successful request:
{
"errcode": 0,
"errmsg": "ok",
"pid": "5g0B4A90aqc"
}
Response Parameters
Parameter | Description |
---|---|
errcode | 0: Success. Otherwise, relevant error code is returned. |
errmsg | Ok: Success. Otherwise, relevant error message is returned. |
pid | Product ID after translation, which will be directly incorporated into the QR code returned by calling the "Get Product QR Code" API. |
# Deleting Product Information
By calling this API, merchants can delete the product information that was successfully created.
Request Example
HTTPRequest method: POST
https://api.weixin.qq.com/scan/product/clear?access_token=access_token
POST data format: JSON
POST data example:
{
"keystandard": "ean13",
"keystr": "6900873042720"
}
Request example
Parameter | Required | Description |
---|---|---|
access_token | Yes | The global certificate of the Official Account, which can be used for the API call. |
keystandard | Yes | Product coding standard |
keystr | Yes | Product coding content |
Response Example
The response JSON packet for a successful request:
{
"errcode": 0,
"errmsg": "ok"
}
Response Parameters
Parameter | Description |
---|---|
errcode | 0: Success. Otherwise, relevant error code is returned. |
errmsg | Ok: Success. Otherwise, relevant error message is returned. |
# Redirection URL Parameters
Scene description:
After a user taps on the product service promotion area URL (Link type), the redirection URL will carry wxkeystand, wxkeystr, wxticket and wxextinfo. By checking wxticket, you can confirm the visitor's source and identity to manage operation precisely.
URL example: http://p.url.cn/wxscandemo/yangbanjian/fangweilanding?91eddae46161ae26a3e6e928f3c07147=scan&wxkeystandard=qrcode&wxkeystr=cosmetics1&wxticket=azlsdGljdXo4Ymow&wxextinfo=123
Parameters
Parameter | Description |
---|---|
wxkeystand | Product coding standard |
wxkeystr | Product coding content |
wxticket | The credential parameter to identify the source. You can get the product and visitor information via the "Check wxticket" API. In particular, when users share links, Weixin will empty wxticket to ensure security. |
wxextinfo | extinfo, an identification parameter for calling the "Get Product QR Code" API. |
# Checking wxticket
By calling this API, you can check the product page of the current visitor's source, as well as the user's identity information obtained in the front-end webpage. To ensure the correctness of the source, the wxticket parameter is only valid for 20 minutes as a temporary signature. The check will fail if it is not finished within 20 minutes.
Request Example
HTTPRequest method: POST
https://api.weixin.qq.com/scan/scanticket/check?access_token=access_token
POST data format: JSON
POST data example:
{
"ticket": " Ym1haDlvNXJqY3Ru1",
}
Request Parameters
Parameter | Required | Description |
---|---|---|
access_token | Yes | The global certificate of the Official Account, which can be used for the API call. |
ticket | Yes | The wxticket parameter in the request URL |
Response Example
The response JSON packet for a successful request:
{
"errcode":0,
"errmsg":"ok",
"keystandard":"ean13",
"keystr":"6901481811083",
"openid":"otAzGjrS4AYCmeJM1GhEOcHXXTAo",
"scene":"scan",
"is_check": false,
"is_contact": false
}
Response Parameters
Parameter | Description |
---|---|
errcode | 0: Success. Otherwise, relevant error code is returned. |
errmsg | Ok: Success. Otherwise, relevant error message is returned. |
keystandard | Product coding standard |
keystr | Product coding content |
openid | The current visitor's openid that uniquely identity a user |
scene | Scene of opening the product page. 1: by scanning code; 2: from other sources such as chats, Favorites, or Moments. |
is_check | Whether the barcode (QR code) is scanned. true: Yes, false: No. |
is_contact | Whether the Official Account is followed. true: Yes, false: No. |
# Component Messages
After setting the component while creating a product, merchants can call this API to control the display in the component area.
With the "events" pushed by Weixin, merchants can obtain the product information they want to get by scanning code and the previously configured "extinfo". By comparing with the local information, users can identify the authenticity of the products and send the result back to Weixin via this API. Then, Weixin will display the query result on the customized page of the Weixin app.
After the merchant sets the component content, the information interaction mode of [User-Weixin-Merchant] is as follows:
Example of pushing XML
<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>
Pushed Parameters
Parameter | Description |
---|---|
ToUserName | The original ID of the merchant's Official Account |
FromUserName | User's openid |
CreateTime | Message creation time (integer) |
MsgType | Message type (event) |
Event | Event type. scan_product_callback represents a component message event. |
KeyStandard | Product coding standard |
KeyStr | Product coding content |
ExtInfo | extinfo, an identification parameter for calling the "Get Product QR Code" API. |
NeedAntiFake | Whether to use the Weixin pop-up page to display the authenticity result. true: Yes; false: No. |
Example of the returned XML
<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>
Response Parameters
Parameter | Description |
---|---|
ToUserName | User's openid |
FromUserName | The original ID of the merchant's Official Account |
CreateTime | Message creation time (integer) |
MsgType | Message type, scanproduct. |
KeyStandard | Product coding standard |
KeyStr | Product coding content |
ExtInfo | extinfo, an identification parameter for calling the "Get Product QR Code" API. |
AntiFake | The content of the anti-counterfeiting message |
CodeResult | Whether the product is authentic, real: Yes; fake: No; not_active: The code is not activated. |
# Clearing Code Scanning Record
When you set the Native Anti-Counterfeiting Component on the product page (see product creation), Each scan made by a user to view the page will be counted and then displayed in the "Anti-Counterfeiting Query Details". This API is used to clear a code's scanning record.
Request Example
HTTPRequest method: POST
https://api.weixin.qq.com/scan/scanticket/check?access_token=access_token
POST data format: JSON
POST data example:
{
"keystandard": "ean13",
"keystr": "6900000000000",
"extinfo":"extinfo"
}
Request Parameters
Parameter | Required | Description |
---|---|---|
access_token | Yes | The global certificate of the Official Account, which can be used for the API call. |
keystandard | Yes | Product coding standard |
keystr | Yes | Product coding content |
extinfo | Yes | extinfo, an identification parameter for calling the "Get Product QR Code" API. |
Response Example
The response JSON packet for a successful request:
{
"errcode":0,
"errmsg":"ok"
}
Response Parameters
Parameter | Description |
---|---|
errcode | 0: Success. Otherwise, relevant error code is returned. |
errmsg | Ok: Success. Otherwise, relevant error message is returned. |