QR code generation tool for applet parameters: Sesame applet code
Support interface A, QR code of chrysanthemum applet parameters. Interface B: QR code of applet scene, Interface C: QR code of ordinary applet
Get QR codeThe QR code of any page of the applet can be obtained through the background interface, and scanning the QR code can directly enter the page corresponding to the applet. At present, WeChat supports two kinds of QR codes, Mini Program Code (left) and Mini Program QR Code (right), as shown below:
Get the applet code
We recommend generating and using the applet code, which has better recognition. Currently, there are two interfaces that can generate applet code, and developers can choose the appropriate interface according to their needs.
Interface A: Applicable to business scenarios requiring fewer codes. Interface address:
https://api.weixin.qq.com/wxa/getwxacode?access_token=ACCESS_TOKEN
Get access_token see documentation
POST parameter description
parameter | Types of | Defaults | illustrate |
---|---|---|---|
path | String | Cannot be empty, the maximum length is 128 bytes | |
width | Int | 430 | QR code width |
auto_color | Bool | false | Automatically configure the line color. If the color is still black, it is not recommended to configure the main color |
line_color | Object | {"r":"0","g":"0","b":"0"} | It takes effect when auth_color is false. Use rgb to set the color such as {"r":"xxx","g":"xxx","b":"xxx"} |
Note: The applet code generated through this interface is permanently valid. Please use it with caution. After the user scans the code to enter the applet, he will directly enter the page corresponding to the path.
Interface B: suitable for business scenarios that require a large number of codes or are only used temporarily
interface address:
https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=ACCESS_TOKEN
Get access_token see documentation
POST parameter description
parameter | Types of | Defaults | illustrate |
---|---|---|---|
scene | String | Maximum 32 visible characters, only numbers, uppercase and lowercase English and some special characters are supported: !#$&'()*+,/:;=?@-._~, please encode other characters as legal characters by yourself (because they are not Support %, Chinese cannot be processed by urlencode, please use other encoding methods) | |
page | String | It must be a published applet page, such as "pages/index/index", do not add '/' before the root path, and cannot carry parameters (please put the parameters in the scene field), if you do not fill in this field, the default jump to the home page noodle | |
width | Int | 430 | QR code width |
auto_color | Bool | false | Automatically configure the line color. If the color is still black, it is not recommended to configure the main color |
line_color | Object | {"r":"0","g":"0","b":"0"} | It takes effect when auto_color is false, use rgb to set the color such as {"r":"xxx","g":"xxx","b":"xxx"} |
Note: The applet code generated through this interface is permanently valid, and the number is temporarily unlimited. After the user scans the code to enter the applet, the developer needs to obtain the value of the scene field in the code on the corresponding page, and then do the processing logic. Use the following code to get the value of the scene field in the QR code. In the debugging stage, you can use the conditional compilation custom parameter scene=xxxx of the development tool to simulate, and the parameter value of the scene during the simulation of the development tool needs to be urlencode
// 这是首页的 js
Page({
onLoad: function(options) {
// options 中的 scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
var scene = decodeURIComponent(options.scene)
}
})
Get the QR code of the applet
Interface C: suitable for business scenarios that require a small number of codes
interface address:
https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=ACCESS_TOKEN
Get access_token see documentation
POST parameter description
parameter | Types of | Defaults | illustrate |
---|---|---|---|
path | String | Cannot be empty, the maximum length is 128 bytes | |
width | Int | 430 | QR code width |
Note: The QR code of the applet generated through this interface is permanently valid. Please use it with caution. After the user scans the code to enter the applet, he will directly enter the page corresponding to the path.
Example:
{"path": "pages/index?query=1", "width": 430}
Note: pages/index needs to app.json
be pages
defined in
Bug & Tip
tip
: Through this interface, only the QR code of the published applet can be generated.tip
: You can generate a QR code with parameters for the development version when previewing the developer tools.tip
: Interface A plus interface C, the total number of generated codes is limited to 100,000, please call with caution.tip
: POST parameters need to be converted into json strings, form submission is not supported.tip
: auto_color line_color parameter is only valid for applet code.