WeChat Open Platform

Mini Programs Documentation

Special API Debugging

Mini Program developer tools are simulations of the WeChat client. The ones that are restricted to desktop devices are different from those for mobile devices. There is some data specific to WeChat, and convenience for developers has also been taken into account, so there are differences between some APIs in the tools and in WeChat.

Scanning interface

Unlike directly calling the camera to scan QR codes on a phone, calling a camera to scan a QR code and complete debugging on a PC or Mac is an inefficient action. Therefore, after calling the QR code scanning API in development tools, developers can select a local image for performing subsequent logic debugging. This is not genuinely enabling the camera for scanning, the process is different, but the input and output of the interface are the same.

WeChat Pay

The latest versions of developer tools already support WeChat Pay debugging, but in order to take security into account, there are differences from calling WeChat Pay directly on a phone:

  • Newly bound developers only have the permissions to perform WeChat Pay debugging after 24 hours.
  • After developers call the WeChat Pay API in the tools, a QR code will appear in the development tools. Developers must complete the payment process on a phone after using the WeChat ID used for the current development to scan the code.
  • The tools will synchronize the mobile terminal WeChat Pay return packet, developers perform the follow-up actions themselves.

The interactions used are different, but the interface's input and output tools are kept consistent with the client's.

Ordinary forwarding

Calling Forward in Developer Tools is a simulated action and will not really forward anything to a user. Developers can use this simulated action to determine whether the Forward API has been called correctly.

Forwarding with shareTicket

Forwarding with shareTicket can obtain more forwarding information, for example, group chat names and the group ID openGId. Developers can use the following methods in the Mini Program developer tools to debug forwarding with shareTicket.

When the called wx.showShareMenu parameter withShareTicket is true, the Forward button will appear after the menu in the top right corner of the simulator is clicked on. A test group list will appear, as shown in the image:

withShareTicket

Developers can click and select any group to get shareTicket via the interface's return packet. The related forwarding information can be obtained by calling wx.getShareInfo.

When developers require debugging to start from a certain group point and involve a shareTicket scenario, they can use the Mini Program message card (with shareTicket)in the1044:group chat session in custom compilation. They can also select any simulation test group, as shown in the image:

withShareTicket

Entered scene values

Users can open Mini Programs in every scenario in the WeChat client. Details. However, there is no real environment for simulating these scenarios in Developer Tools. Developers can achieve the objective of debugging different scenarios using the conditional compilation method.

scene

Enabling the use of custom parameters

During everyday use, users can open a Mini Program and jump to a corresponding Mini Program page on the basis of an imported path without launching the page, or use parameters to enable the Mini Program to distinguish the default open state. In Developer Tools, developers can also use the conditional compilation method to achieve the objective of debugging different paths and parameters.

For example, the image below shows that the selected page to enter is pages/name/name and the parameter is name=linchao

args.

Previewing the use of custom parameters

This is the same as enabling the use of custom parameters. When submitting a preview, developers can use the custom preview method to achieve the objective of debugging different paths and parameters on a mobile device.

For example, the image below shows that the selected page to enter is pages/name/name and the parameter is name=linchao

uploadfortest