# Membership card component
Developers can call the interface in the Mini Program pull up the membership card components, convenient for users to quickly fill in the membership registration information and get the card. The interface pulls open card components without binding the open card component and the initiator Mini Program to the same Official Account message template, Developers can call directly.
The developer must complete the following steps before calling:
- Create a WeChat membership card and set it to one-click activation mode
- Set Card Opening Field
- Get Open Card Component Parameters
For details, see the member card components:Member card card component
# Parameter explaination
Parameter name | type | Is it necessary to fill out | Parameter explaination |
---|---|---|---|
appId | String | yes | fill in Wxeb490c6f9b154ef9, fixed to this appid |
extraData | Object | yes | The open card component parameter, obtained in step 3, contains the following three parameters |
encrypt_card_id | String | yes | encryption card_Id, before incoming urldecode |
outer_st | String | yes | Membership card to receive channel value, card coupons will receive event back to the merchant |
we | String | yes | merchant Official Account message template Identification parameter must be passed in urldecode |
success | Function | no | Interface to call a successful callback function |
fail | Function | no | Interface calls failed callback functions |
complete | Function | no | Interface calls the end of the callback function (call success or failure will be executed) |
# Return parameters
Parameter name | type | Parameter explaination |
---|---|---|
errMsg | String | Call result |
# sample code
wx.navigateToMiniProgram({
appId: 'wxeb490c6f9b154ef9', //Fixed for this purpose Appid, immutable
extraData: data, // Include encrypt_card_id, outer_st Biz three fields that must be derived from the step3 Get parameters in the link obtained in
success: function() {
},
fail: function() {
},
complete: function() {
}
})
navigateToMiniProgram
Interface is about to be deprecated, use thenavigatorComponent to use this feature
<navigator target="miniProgram" app-id="wxeb490c6f9b154ef9" extra-data="{{data}}">Membership card opening</navigator>
# Return Dxplaination
in App.onShow Determine the data returned from the member card Mini Program
- judge data.referrerInfo.appId Whether to open card Mini Program appId
wxeb490c6f9b154ef9
If not, suspend judgment - Determine if there is data.referrerInfo.extraData Whether there is data, if not, the user is not activated directly left swipe/Or the user has already activated the
- If the user activates successfully, the data.referrerInfo.extraData Get activate_ticket,card_id,code Parameter for the next step
# Note
- Call this on the developer tools API Does not actually jump to another Mini Program, but the developer tool will verify the success of the call jump details
- Debugging details on the developer tool that supports the jumped Mini Program handling the received parameters
- Open card component is the use of wx.navigateToMiniProgram development of the official component, jump without binding the same Official Account message template, Call directly