Plug-in development and use has been supported since applets base library version 1.9.6. If the plug-in contains pages, base library version 2.1.0 is required

  • A plug-in is a wrapper around a set of JS interfaces, custom components, or pages that can be embedded into an applet
  • Plug-ins cannot run independently and must be embedded in other applets to be used by users
  • Third-party applets cannot see the plug-in code when using it. Therefore, plug-ins are suitable for encapsulating their own functions or services to be displayed and used by third-party applets.
  • There are limitations, such as some apis that can’t be called or have limited functionality. There are also special interfaces that the plug-in cannot call directly, but can implement indirectly using the plug-in function page.
  • The framework secures data for applets and each plug-in they use to ensure that they cannot steal data from either party (unless the data is actively passed to the other party).

Open scope and service categories and development access process

Learn briefly about development access

Limitations on plug-in API calls
  • The plugin’s request domain name list is independent of the applet.
  • Some apis do not allow plug-in calls (these functions do not exist under wX objects).
  • Some interfaces cannot be used in plug-ins, but can be achieved through the plug-in function page, see the plug-in function page.
Limitations on the use of components by plug-ins
  • Button with one of the following open-type capabilities: contact getPhoneNumber getUserInfo

  • open-data

  • The use of the following components of web-view requires the base library version:

  • Navigator requires base library version 2.1.0

  • Live-player and live-pusher require base library version 2.3.0

Plug-in function page

The plug-in feature page is supported starting with widget Base version 2.1.0.

Some interfaces cannot be called directly from the plug-in (such as wx.login), but plug-in developers can use the plug-in feature page to implement functionality. Currently, the plug-in feature pages include:

  • To obtain user information, including OpenID and nickname (equivalent to wx.login and wx.getUserInfo), see the User Information function page.
  • Payment (equivalent to wx.requestPayment), see payment features page;
  • Get the shipping address (equivalent to Wx.chooseAddress), see the shipping Address feature page.

To use the plug-in function page, you need to activate the feature page, configure the corresponding function page function, and then use the functional-Page-navigator component to jump to the plug-in function page to realize the corresponding function.

Go to the features page

Function pages cannot be jumped to using wx.navigateTo, but instead require a component called functional-Page-navigator. To get user information, for example, you can place the following functional-Page-navigator in your plug-in:

<functional-page-navigator name="loginAndGetUserInfo" args="" version="develop" bind:success="loginSuccess"</button> </functional-page-navigator>Copy the code

When users click on the Navigator, they are automatically redirected to the corresponding feature page of the plug-in owner applet. The function page prompts the user to log in or perform other operations. The result is returned as a component event. Support for plug-in owner applets to jump to their own feature pages starting with Applets Base version 2.4.0. If the base library version is lower than 2.4.0, clicking on the functional-Page-Navigator to jump to its own feature page will have no effect.

User information function page

The user information feature page is used to help plug-ins get user information, including OpenID and nickname, and is equivalent to wx.login and wx.getUserInfo.

In addition, as of base library version 2.3.1, plug-ins can call wx.login and wx.getUserinfo directly after the user is authorized in this feature page. You do not need to go to the function page again to obtain user information. As of base library version 2.6.3, you can use wx.getSetting to check whether a user is authorized.

Payment function page

The payment feature page is used to help the plug-in complete the payment, which is equivalent to the wx.requestPayment feature.

Note that: To use the payment function of the plug-in, you need to apply for additional permission. The application location is in the Settings of “Small program Plug-ins -> Basic Settings -> Ability to Pay” in the management background. In addition, regardless of whether through application, the main personal small program when using the plug-in, can not normally use the plug-in payment function.

Shipping address function page

The receiving Address function page is used to display the receiving address list of the user. The user can select the receiving address in the list. Supported as of base library version 2.4.0.