Opening a Mini Program By Scanning a Common Link QR Code

To allow Mini Program developers to conveniently promote Mini Programs and ensure compatibility with existing offline QR codes, the WeChat Official Accounts Platform provides the capability to redirect to Mini Programs by scanning common link QR codes.

Feature Description

Common link QR codes refer to QR codes that are generated after developers encode web links via tools.

Offline merchants do not need to change offline QR codes. Instead, after configurations are complete in the Mini Program admin console, users can scan the common link QR codes to open Mini Programs and use Mini Program features.

Common link QR codes currently support two redirect methods: users go to Discover and tap Scan to scan a common link QR code, or they press and hold the image of a common link QR codes within WeChat and select Extract QR Code.

Applicable Scope

Mini Programs owned by companies, media, governments, and other organizations

QR Code Redirect Rules

Note: As of May 2017, the WeChat client supports subpath matching during configuration of a QR code rule. For example, the link to the original QR code is http://www.qq.com/a/123456, where 12345 is the service parameter. In this case, the rule can be configured as http://www.qq.com/a/, to allow users to redirect to the Mini Program by scanning the QR code.

During QR code scanning, the WeChat client will control redirect according to the following matching rules:

  1. The protocol and domain name in the QR code link must be consistent with those in the configured QR code rules.
  2. The QR code link belongs to the subpath of the QR code rule configured in the admin console. (If subpath matching needs to be supported, ensure that the configured QR code rule ends with a backslash (/).)
  3. If the QR code rule contains a parameter, the parameter is following the question mark ? in the link. The parameter in the rule and the parameter in the link must contain the same prefix.

Common matching errors:

QR Code Rule Configured in the Admin Console Complete Offline QR Code Link Error Cause
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 Parameter prefixes are different.
https://www.qq.com/a/b https://www.qq.com/a/bc The rule does not belong to the subpath.
https://www.qq.com/a/b https://www.qq.com/a/b/123 The rule does not end with a backslash (/). Therefore, subpath matching is not supported.

Extracting Content from a QR Code

After the rule for redirecting to a Mini Program by scanning a QR code is configured in the Mini Program admin console, users can open a Mini Program by scanning the QR code on WeChat 6.5.6 or later.

The content of the QR code link is displayed on the page as the q parameter. To obtain the complete content of the original QR code, extract the q parameter from the onLoad event and call decodeURIComponent once.

Configuration Process

Log in to the Mini Program admin console and choose Settings > Development Settings. Enable Scan a Common Link QR Code to Open a Mini Program. Then, you can configure a QR code rule.

QR Code Rules

According to QR code redirect rules, developers need to enter the rules for the QR codes that are to be redirected to Mini Programs. Specific requirements are as follows:

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

  2. Links prefixed with http, https, and ftp (for example, http://wx.qq.com, https://wx.qq.com/mp/, and https://wx.qq.com/mp?id=123) are supported.

  3. A maximum of 10 QR code prefix rules can be configured for one Mini Program account.

Rules for Using Prefixes Exclusively

Developers can choose whether to exclusively use all sub-rules that comply with the QR code matching rules. If they choose to use these sub-rules exclusively, other accounts cannot apply to use other sub-rules with the matched prefixes.

For example, if developer A configures a QR code rule as https://wx.qq.com/mp?id=123 and selects Use all sub-rules exclusively, other developers cannot configure sub-rules with matched prefixes, for example, https://wx.qq.com/mp?id=1234.

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

Verification File

To pass ownership verification, you need to download a random verification file and upload the file to a directory at a specified location on the server.

Rules for storing the verification file: Store the verification file in the last sub-directory declared in the URL. If there is no sub-directory, store it in the top-level directory of the server to which the host belongs. If a hint is displayed on the page, store the verification file in the specified directory.

Feature Page of the Mini Program

Developers can configure the path to redirect to a feature page of the Mini Program after a QR code is scanned, such as pages/index/index.

Testing and Debugging

Developers can test and debug configured QR code rules.

Testing takes effect only for specified test links and WeChat users who fall into the test scope. Other users can still be redirected to a web page after scanning a QR code, and use Mini Programs normally. After releasing the QR code rule, developers can still test a selected version (developer, test, or online version).

Test scope

To test the feature of redirecting to Mini Programs by scanning common link QR codes, developers can select developer version, test version, or online version according to the development progress.

Before testing, a developer must enter a complete QR code link that complies with a QR code prefix matching rule. If this link contains a parameter, provide the complete parameter.

You can enter a maximum of five test links 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 linked to a Mini Program, the specified version of Mini Program will be opened.

Release

Developers can publish QR code redirect rules to the existing network after testing. Then, all QR codes that comply with matching rules will be redirected to the specified Mini Program page after being scanned.

To guarantee good user experience, Mini Program code must be released before QR code redirect rules for the Mini Programs.

A maximum of 20 QR code redirect rules can be released for a Mini Program account per month.