提示:小程序卡券和公众平台调用基本一致,请先查看公众平台卡券文档 一、公众帐号/小程序绑定 由于微信卡券用的是一套逻辑。所以小程序需要先和公众账号绑定,才能在小程序中调起公众平台卡券 登录微信公众平台:h ...
提示:小程序卡券和公众平台调用基本一致,请先查看公众平台卡券文档
[PHP]
$access_token ='Yn6h-PM679IXWtndisSKGtxWHV3rHpIl9IrUVFgE96m4aKbhyVDiG34OuOUGs_SIIceQSplwLWWexURWiuXGyTkaYXU8pFW-goveJ8XQJvpSU1KX9UnUssssssssssQhAAAGWZ';
$post ='{
"card_id":"cccccccccccccccccc-dw",
"gift": {
"base_info": {
"custom_url_name": "小程序",
"custom_url": "",
"custom_app_brand_user_name": "gh_aaaaaaaaaaa@app",
"custom_app_brand_pass":"pages/index/index",
"custom_url_sub_title": "点击进入",
"promotion_url_name": "更多信息",
"promotion_url": "",
"promotion_app_brand_user_name": "gh_aaaaaaaaaaa@app",
"promotion_app_brand_pass":"pages/index/index"
}
}
}';
$url ="https://api.weixin.qq.com/card/update?access_token={$access_token}";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
if(!empty($post)){
curl_setopt($curl, CURLOPT_POST,1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$output = curl_exec($curl);
curl_close($curl);
var_dump($output);
die();
三、卡券签名 卡券签名与公众号卡券签名一致,注意使用api_ticket签名 参考文档:https://mp.weixin.qq.com/wiki?ac ... 52296&highline=card|%26amp%3Bcardext#fl4 卡券签名验证工具:https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=cardsign 四、小程序调用 注意点: 1、卡券字段use_custom_code填写为false时,code字段不用加到cardExt 2、卡券字段bind_openid填写为false是,openid字段不用加到cardExt 3、当签名时使用nonce_str字段签名时,nonce_str字段需要加到cardExt
[JavaScript]