小程序&卡券打通
1 打通主要支持特性
支持在小程序中領(lǐng)取/查看/使用公眾號(hào)AppId創(chuàng)建的會(huì)員卡、票、券(含通用卡)。
注:創(chuàng)建卡券部分可見(jiàn)卡券接口文檔。
2 商家需要做什么
2.1. 需在open平臺(tái)綁定公眾號(hào)AppId與小程序AppId,詳情查看https://open.weixin.qq.com/cgi-bin/announce?action=getannouncement&key=1439297282&version=10&lang=zh_CN&token=;
2.2. 原卡券中配置的自定義外鏈基礎(chǔ)上新增一組小程序頁(yè)面配置字段,支持將卡券內(nèi)鏈接升級(jí)為小程序;
2.3. 以小程序AppId調(diào)用添加/查看卡券JS-API,簽名參數(shù)與公眾號(hào)Addcard/Opencard JS-SDK一致;
2.4. 核銷(xiāo)卡券、數(shù)據(jù)查看保持現(xiàn)網(wǎng)路徑,商家無(wú)需調(diào)整。
3 商家接入落地的接口內(nèi)容
3.1. 創(chuàng)建接口/更新卡券信息接口base_info中新增進(jìn)入小程序頁(yè)面字段,商家需將小程序字段配置進(jìn)原自定義外鏈結(jié)構(gòu)體中,小程序頁(yè)面新增字段示例如下:
{ "card": {
"card_type": "MEMBER_CARD",
"member_card": {
"base_info": {
"custom_url_name": "立即使用",
"custom_url": "http://www.qq.com",
"custom_app_brand_user_name": "gh_86a091e50ad4@app",
"custom_app_brand_pass":"API/cardPage",
"custom_url_sub_title": "6個(gè)漢字tips",
"promotion_url_name": "更多優(yōu)惠",
"promotion_url": "http://www.qq.com",
"promotion_app_brand_user_name": "gh_86a091e50ad4@app",
"promotion_app_brand_pass":"API/cardPage" }
}
}
字段名 | 字段描述 | 字段示例 |
custom_app_brand_user_name | 自定義使用入口跳轉(zhuǎn)小程序的user_name,格式為原始id+@app | gh_86a091e50ad4@app |
custom_app_brand_pass | 自定義使用入口小程序頁(yè)面地址 | API/cardPage |
center_app_brand_user_name | 小程序的user_name | gh_86a091e50ad4@app |
center_app_brand_pass | 自定義居中使用入口小程序頁(yè)面地址 | API/cardPage |
promotion_app_brand_user_name | 小程序的user_name | gh_86a091e50ad4@app |
promotion_app_brand_pass | 自定義營(yíng)銷(xiāo)入口小程序頁(yè)面地址 | API/cardPage |
activate_app_brand_user_name | 小程序的user_name, | gh_86a091e50ad4@app |
activate_app_brand_pass | 激活小程序頁(yè)面地址 | API/cardPage |
-- | -- | -- |
*需調(diào)用卡券更新接口將相應(yīng)小程序頁(yè)面更新至對(duì)應(yīng)跳轉(zhuǎn)外鏈結(jié)構(gòu)體中,原跳轉(zhuǎn)H5字段保留。
3.2. 領(lǐng)取/查看卡券的接口參數(shù)不變,以小程序的AppId調(diào)用JSSDK,填入公眾號(hào)AppId下的參數(shù)。查看接口文檔。
// 微信低版本下尚未支持小程序卡券 wx.addCard, wx.openCard,
// 這兩個(gè)接口調(diào)用前請(qǐng)先判斷,示例:
if ( typeof wx.addCard === 'function' ) {
wx.addCard({
cardList: [{
cardId: '',
cardExt: ''
}], // 需要添加的卡券列表,cardExt內(nèi)的簽名使用公眾號(hào)appid獲取
success: function (res) {
var cardList = res.cardList; // 添加的卡券列表信息
}
})};
更多建議: