Scan Ordinary Link QR Codes to Open Mini Programs
To enable Mini Program developers to promote Mini Programs more easily and ensure compatibility with existing QR codes, the WeChat Official Account Platform has opened up the capability of launching Mini Programs by scanning ordinary link QR codes.
Ordinary link QR codes refer to QR codes that are generated after developers encode web links with tools.
Offline vendors do not need to change offline QR codes. After configurations are complete in the Mini Program backend, users can scan ordinary QR codes to launch Mini Programs and use their functions.
Currently, users can scan ordinary link QR codes by using Scan QR Code or by holding down Extract QR Code in WeChat to launch Mini Programs.
Mini Programs of companies, media, governments, and other organizations
QR code redirection rules
Since May 2017, a WeChat client supports "subpath matching" for a QR code rule. If the original QR code link is
http://www.qq.com/a/123456 with 12345 as a business parameter, the
http://www.qq.com/a/ rule can be configured to enable the launch of Mini Programs by code scanning.
When QR codes are scanned, the WeChat client will control redirection in accordance with the following matching rules:
- QR code link protocols and domain names must be consistent with configured QR code rules.
- QR code links must be subpaths in the QR code rules configured in the backend. (If subpath matching must be supported, ensure that a configured QR code rule ends with a backslash
- If a QR code rule contains a parameter, the parameter is preceded by the question mark
?in a link. Prefixes of the parameters in the rule and in the link must be the same.
Common matching errors:
|Configured QR Code Rule||Complete Offline QR Code Link||Error Reason|
|http://www.qq.com/a/b||https://www.qq.com/a/b||Protocols are different.|
|https://www.qq.com/a/b||https://www.weixin.qq.com/a/b||Domain names are different.|
|https://www.qq.com/a/b?id=123||https://www.qq.com/a/b?id=132||Prefixes of parameters are different.|
|https://www.qq.com/a/b||https://www.qq.com/a/bc||The link is not the subpath of the rule.|
|https://www.qq.com/a/b||https://www.qq.com/a/b/123||The rule does not end with a backslash (|
QR Code Content Acquisition
When the rule for launching a Mini Program with a QR code has been configured on the Mini Program backend, users can open the Mini Program by scanning a QR code with the WeChat client (version 6.5.6 or above).
The QR code link content will be sent to the page using the
q parameter. You can extract the
q parameter from the onLoad event and run
decodeURIComponent once to acquire the complete content of the original QR code.
Log in to the Mini Program backend and choose Settings > Development Settings > Scan Ordinary Link QR Code To Open Mini Program. You can configure QR code rules after enabling this function.
QR code rules
According to QR code redirection rules, developers are required to enter the QR code rules required for the launch of Mini Programs. Specific requirements are as follows:
Domain names in QR code rules must pass ICP license verification.
Links starting with http, https, and ftp (such as
https://wx.qq.com/mp?id=123) are supported.
A maximum of ten QR code prefix rules can be configured for a Mini Program account.
Rules for using prefixes exclusively
Developers can choose whether to exclusively use all sub-rules that comply with QR code matching rules. If they choose to use these sub-rules exclusively, other accounts cannot apply for permission to use other sub-rules that satisfy prefix matching rules.
If a developer configures QR code
https://wx.qq.com/mp?id=123 and select to use all sub-rules exclusively, other developers will be unable to configure sub-rules that satisfy prefix matching such as
If the message "This rule is already in use" appears, contact the corresponding Mini Program developer to resolve this issue.
To pass ownership verification, you need to download random verification documents and upload these documents to a directory in a designated location on the server.
Verification document placement rules: Place verification documents under the last sub-directory declared in a URL. If there is no sub-directory, place them under the top-level directory of the server that the host belongs to. Place verification documents under the designated directory according to prompts on the page.
Mini Program function page
Developers can configure the path of the Mini Program function page that is displayed after QR code scanning, for example,
Testing and debugging
Developers can test and debug configured QR code rules.
Testing is valid only for specified test links and WeChat users involved. Other users can still be redirected to a web page after scanning a QR code and use Mini Programs normally. After release of QR code rules, developers can still test them in a designated version (development, experience, or online version).
Developers can choose to test the function of Launching a Mini Program via Ordinary QR Code in the development, experience, or online version based on the development progress.
A developer must enter a complete QR code link that complies with a QR code prefix matching rule for testing. If this link contains a parameter, provide a complete one.
A maximum of five test links can be entered for one rule, and they can be repeatedly modified. If a QR code matches a test link and a user's WeChat ID is that of an administrator, developer, or experiencer designated for a corresponding Mini Program, the designated version of the Mini Program will be opened.
Developers can publish QR code redirection rules on the existing network after testing. After the rules are published, scanning any QR code that complies with matching rules will redirect you to the designated Mini Program page.
To guarantee good user experience, code must be released before QR code redirection rules for Mini Programs.
A maximum of 20 QR code redirection rules are allowed for a Mini Program account per month.