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.

Function description

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.

Applicable scope

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:

  1. QR code link protocols and domain names must be consistent with configured QR code rules.
  2. 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 /.)
  3. 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 (/), so subpath matching is not supported.

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.

Configuration process

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:

  1. Domain names in QR code rules must pass ICP license verification.

  2. Links starting with http, https, and ftp (such as http://wx.qq.com, https://wx.qq.com/mp/, and https://wx.qq.com/mp?id=123) are supported.

  3. 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 https://wx.qq.com/mp?id=1234.

If the message "This rule is already in use" appears, contact the corresponding Mini Program developer to resolve this issue.

Verification documents

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, pages/index/index.

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).

Test scope

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.

Publishing

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.