May 18, 2021 WeChat Mini Program Development Document
The small program card interface supports membership cards, tickets, and vouchers (including universal cards) created by appId using the public number in the small program. More ways to use it can be used by referring to the small program and card coupons to get through
At present, only certification small programs can use the voucher interface, can refer to the guidelines for certification.
Within the small program, the user can be added a voucher through the wx.addCard interface. Give users the option of an existing voucher through wx.openCard.
Developers can call the interface in a small program to pull up the membership card component, so that users can quickly fill in the membership registration information and receive a card. The interface pulls up the card-opening component without binding the card-opening component and initiating the small program to the same public number in advance, and the developer can call it directly.
The developer must complete the following steps before calling:
For more information, please view the introduction of the member card opening component: the member card opening component
Description of the parameters
The name of the argument | Type | Is it required | Description of the parameters |
---|---|---|---|
appId | String | Is | Fill in wxeb490c6f9b154ef9, pinned to this appid |
extraData | Object | Is | The card opening component parameters, obtained by Step 3, contain the following three parameters |
encrypt_card_id | String | Is | Encryption card_id, urldecode is required before it can be passed in |
outer_str | String | Is | Membership card to receive channel value, will be in the card collection event back to the merchant |
biz | String | Yes | Merchant public account identifies parameters, there must be URLDECode before incoming |
success | Function | no | Interface call successful callback function |
fail | Function | Whether | The interface calls the failed callback function |
complete | Function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Return parameters
The name of the argument | Type | Description of the parameters |
---|---|---|
errMsg | String | The result of the call |
The sample code
wx.navigateToMiniProgram({
appId: 'wxeb490c6f9b154ef9', //固定为此 appid,不可改动
extraData: data, // 包括 encrypt_card_id, outer_str, biz三个字段,须从 step3 中获得的链接中获取参数
success: function() {
},
fail: function() {
},
complete: function() {
}
})
The navigateToMiniProgram interface is about to be deobsolete, and the new version uses the navigator component to use this feature
<navigator target="miniProgram" app-id="wxeb490c6f9b154ef9" extra-data="{{data}}">会员卡开卡</navigator>
Return to the description
In App.onShow, determine the data data returned from the member card opening program