标签:name res ber param strong text ue4 lang bridge
1. 登录 微信公众平台 ;
2. 点击左边菜单里面的微信支付查看相关商户号,确定该公众号支付针对由哪个商户号进行收款;
3. 登录步骤2中的商户平台,点击产品中心,开启支付产品-公众号支付(如果已开通可以忽略该步骤);
4. 继续点击商户平台->产品中心->开发配置,确定商户号是否和即将开发的公众号支付一致。查看支付配置->公众号支付
添加相应的JSAPI授权目录,添加规则具体参见:微信公众号支付开发当前URL未注册解决办法
5. 回到公众平台,设置->公众号设置->功能设置,添加JS接口安全域名和网页授权域名;
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <h1>openId : {$openId}</h1> <button style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer; color:white; font-size:16px;" type="button" onclick="callpay()" >立即支付</button> <script type="text/javascript"> function callpay(){ if (typeof WeixinJSBridge == "undefined"){ if( document.addEventListener ){ document.addEventListener(‘WeixinJSBridgeReady‘, jsApiCall, false); }else if (document.attachEvent){ document.attachEvent(‘WeixinJSBridgeReady‘, jsApiCall); document.attachEvent(‘onWeixinJSBridgeReady‘, jsApiCall); } }else{ jsApiCall(); } } //调用微信JS api 支付 function jsApiCall(){ WeixinJSBridge.invoke( ‘getBrandWCPayRequest‘, <?php echo $jsApiParameters; ?>, function(res){ WeixinJSBridge.log(res.err_msg); alert(res.err_code+res.err_desc+res.err_msg); } ); } </script> <script type="text/javascript"> //获取共享地址 function editAddress() { WeixinJSBridge.invoke( ‘editAddress‘, <?php echo $editAddress; ?>, function(res){ var value1 = res.proviceFirstStageName; var value2 = res.addressCitySecondStageName; var value3 = res.addressCountiesThirdStageName; var value4 = res.addressDetailInfo; var tel = res.telNumber; alert(value1 + value2 + value3 + value4 + ":" + tel); } ); } window.onload = function(){ if (typeof WeixinJSBridge == "undefined"){ if( document.addEventListener ){ document.addEventListener(‘WeixinJSBridgeReady‘, editAddress, false); }else if (document.attachEvent){ document.attachEvent(‘WeixinJSBridgeReady‘, editAddress); document.attachEvent(‘onWeixinJSBridgeReady‘, editAddress); } }else{ editAddress(); } }; </script> </body> </html>
标签:name res ber param strong text ue4 lang bridge
原文地址:https://www.cnblogs.com/jiangxiaobo/p/9437771.html