# Weixin Mini Program Weixin Mini Program

In order to facilitate Weixin Mini Program developers to promote Mini Programs more conveniently, compatible with offline QR codes, and WeChat the public platform opens the ability to scan commonly linked QR codes to jump Mini Programs.

# Features Description

A common link QR code refers to a QR code generated by a developer using a tool to encode a web link.

Offline merchants may not need to replace offline QR codes, but after the configuration of the Weixin Mini Program backend, they can open the Mini Program when the user scans the normally linked QR codes and use the Mini Program's functions.

For ordinary link two-dimensional code, currently supports the use of WeChat "scan" or WeChat long press recognition two-dimensional code jump Weixin Mini Program.

# Scope of Openness

Corporate, media, government and other types of organizations Weixin Mini Program.

# QR Code Jump Rules

Note: Starting in May 2017, WeChat clients support two-dimensional code rules based on "subpath matching."If the original binary code link ishttp://www.qq.com/a/123456,In which 123456 is the service parameter, then the configuration rulehttp://www.qq.com/a/can be used to scan the code to open Weixin Mini Program.

WeChat The user scan code will control the jump according to the following matching rules:

  1. The protocol and domain name of the QR code link are consistent with the configured QR code rules.
  2. QR code links are a subpath of the back-end configuration of QR code rules.(If you want to support subpath matching, make sure that the binary code rule configured in the background ends with/)
  3. If the binary code rule contains parameters, link?followed by the parameter part, the parameter requires prefix matching.

Common types of matching errors:

The backend has configured QR code rules Offline QR code full link Reasons for the Error
http://www.qq.com/a/b https://www.qq.com/a/b The agreement was inconsistent.
https://www.qq.com/a/b https://www.weixin.qq.com/a/b The domain name is different
https://www.qq.com/a/b?id=123 https://www.qq.com/a/b?id=132 The parameter does not meet prefix matching
https://www.qq.com/a/b https://www.qq.com/a/bc It is not part of a subpath
https://www.qq.com/a/b https://www.qq.com/a/b/123 Rule does not end with/, does not support subpath matching
https://www.qq.com/a/( Released)

https://www.qq.com/a/b( Not Released)
https://www.qq.com/a/b Hit unpublished rule does not jump Weixin Mini Program

# QR code content acquisition

In Weixin Mini Program background configuration two code jump Mini Program rules can be used WeChat (6. 5. 6 and above passenger version) scan code open Mini Program.

The two-dimensional link content is brought to the page as the parameterq, andq is extracted in the onLoad event.Theparameter and self-decodeURIComponent`once (for MiniGame it can be obtained using the wx.getEnterOptionsSync interface) to obtain the full contents of the original QR code.A parameter scancode_time (UNIX timestamp, in seconds) is appended to indicate the time the user scans the code.

Page({
  onLoad(query) {
    const q = decodeURIComponent(query.q) // 获取到二维码原始链接内容
    const scancode_time = parseInt(query.scancode_time) // 获取用户扫码时间 UNIX 时间戳
  }
})

# The configuration process

Log in Weixin Mini Program background, enter the "development management - development settings - scan ordinary link binary code open Mini Program," open the function can configure the binary code rules.

# QR Code Rules

According to the two-dimensional code jump rules, the developer needs to fill in the two-dimensional code rules that need to jump Weixin Mini Program.The requirements are as follows:

  1. The domain name of the two-dimensional code rule must be verified by the ICP filing.

  2. Support links that start with http, https (e.g.http://wx.qq.comhttps://wx.qq.com/mp/https://wx.qq.com/mp?id=123)。

  3. Some accounts support links beginning with hlht, and according to protocol rules, the parameters of the hlht link are in the middle and end with the carrier ID.(e.g.:http://******. Carrier ID)

  4. A Weixin Mini Program account can be configured with no more than 100 binary prefix rules.

# Precursor Occupancy Rules

Developers can choose whether to occupy all subrules that comply with QR code matching rules. If you choose to occupy, other accounts cannot apply to use other subrules that satisfy the prefix matching rule.

For example: If developer A configures a two-dimensional code rule:https://wx.qq.com/mp?id=123,And select "Use all subrules." Other developers will not be able to configure subrules that satisfy prefix matches such ashttps://wx.qq.com/mp?id=1234

If prompted "this rule has been occupied," please contact the corresponding Weixin Mini Program developer communication solution.

# Calibration of documents

Download the random validation file and upload the file to a directory in a location specified by the server before attribution validation can be made.

Verify file placement rules: Place in the last level subdirectory declared in URL or, if there are no subdirectories, in the top-level directory of host's server.Please follow the page prompts to place the validation file in the specified directory.

# Weixin Mini Program Function page

Configure the path of the Weixin Mini Program function page that opens after scanning the binary code, such as:pages / index / index.

# Test debugging

Developers can test and debug configured QR code rules.

The test is only effective for the specified test link and test users within the scope of the test, and other users scan the code and jump the web page, which does not affect the normal use of the whole network. After the QR code rule is released, developers can still choose to test it under a specified version (developer / experience / online version), please note that scanning users must have submitted code to open the development version.

# Scope of testing

Developers can choose according to the development progress in the development version / experience version / online version to test the "ordinary two-dimensional code jump Weixin Mini Program" function.

Fill out a full link to a QR code that meets QR code prefix matching rules for testing. If you include parameters, please fill out it in full.

A rule can fill in no more than 5 test links and can be modified multiple times.If the two dimensional code matches the test link, and the user WeChat number is the administrator / developer / experiencer specified by Weixin Mini Program, the specified version of the Mini Program will open.

# release

After the completion of the test, the developer can release the two-dimensional code jump rules to the net, and after publishing, scan all the two-dimensional code matching rules, and jump to the specified Weixin Mini Program page.

To ensure user experience, Weixin Mini Program must publish code before you can publish two-dimensional code jump rules.

A Weixin Mini Program account can publish no more than 500 two-code jump rules a month.