标签:团队 typeof sch 相关信息 获取 param done www path
$.post("{php echo app_url(‘pay/cash‘)}",{orderno:orderno,paytype:paytype},function(m){ //todo: 跳转到微信支付,获取支付的相关信息 if(!m.errno){ m.data.timeStamp = String(m.data.timeStamp); WeixinJSBridge.invoke(‘getBrandWCPayRequest‘, { ‘appId‘: m.data.appid ? m.data.appid : m.data.appId, ‘timeStamp‘: m.data.timeStamp, ‘nonceStr‘: m.data.nonceStr, ‘package‘: m.data.package, ‘signType‘: m.data.signType, ‘paySign‘: m.data.paySign, }, function(res) { if(res.err_msg == ‘get_brand_wcpay_request:ok‘) { location.href = "{php echo app_url(‘pay/cash‘)}&orderno="+orderno+"&paytype="+paytype+"&done=1"; } else { $.post("{php echo app_url(‘pay/paytype‘)}",{orderno:orderno,remark:remark,othername:othername,op:"ajax",checkpay:"8"},function(m){ $.toast("已取消支付"); },"json"); } }); }else{ $.confirm(m.message, function () { history.go(-1); }) } },"json"); document.addEventListener(‘WeixinJSBridgeReady‘, function onBridgeReady() { WeixinJSBridge.invoke(‘getBrandWCPayRequest‘,pathinfo , function(res) { // Pathinfo:json,相关的信息 if(res.err_msg == ‘get_brand_wcpay_request:ok‘) { location.href=‘/index.php/Mobile/User/order_detail/id/‘+orderid+‘.html‘ } else { location.href=‘{$url}‘ } }); }, false);
https://www.cnblogs.com/xqschool/p/8578508.html
let time = new Date().getTime() function onBridgeReady () { WeixinJSBridge.invoke( ‘getBrandWCPayRequest‘, { "appId": res1.data.appId, //公众号名称,由商户传入 "timeStamp": res1.data.timeStamp + ‘‘, //时间戳,自1970年以来的秒数 "nonceStr": res1.data.nonceStr, //随机串 "package": res1.data.package, "signType": res1.data.signType, //微信签名方式 "paySign": res1.data.paySign //微信签名 }, function (res) { // console.log(‘支付回调:‘, res) if (res.err_msg == "get_brand_wcpay_request:ok") { // 使用以上方式判断前端返回,微信团队郑重提示: //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠 window.location.href = window.location.origin + ‘/#/orderList‘ } else { window.location.href = window.location.origin + ‘/#/orderList‘ } }) } if (typeof WeixinJSBridge == "undefined") { if (document.addEventListener) { document.addEventListener(‘WeixinJSBridgeReady‘, onBridgeReady, false); } else if (document.attachEvent) { document.attachEvent(‘WeixinJSBridgeReady‘, onBridgeReady); document.attachEvent(‘onWeixinJSBridgeReady‘, onBridgeReady); } } else { onBridgeReady(); }
https://www.cnblogs.com/liea/p/11993222.html
function jsApiCall() { try { WeixinJSBridge.invoke( ‘getBrandWCPayRequest‘, <%= WxJsApiParam %> , function(res) { WeixinJSBridge.log(res.err_msg); alert(res.err_code + res.err_desc + res.err_msg); } ); } catch (e) { alert(e); } } function callpay() { try { 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(); } } catch (e) { alert(e); } window.event.returnValue = false; return false; }
https://www.cnblogs.com/zsy/p/5336651.html
微信支付遇到签名验证失败的解决方法
1.下单的签名方式使用MD5方式
2.利用下单获取到的prepay_id,来进行调起支付阶段的paySign的签名
3.如果提示签名验证失败:
①首先检查你的5个参数是否完整:timeStamp,nonceStr,package,signType,paySign
②signType 必须是MD5,官方demo不是MD5,改为MD5,这也是大坑,当然我自己用python 写的时候直接用的MD5
③在做paySign签名的时候,需要6个参数,上述5个参数去掉paySign(不参与签名),加上appId(注意是大写I,这是个大坑,这个错了那签名必然失败)和key
④如果上述步骤没问题还是失败,那么去https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=20_1验证以下你的签名是否通过
⑤还有一点签名的时候必须把所有英文全部转为大写
4.欢迎评论,多多交流
https://www.jianshu.com/p/c7378adfe841
function jsApiCall() { WeixinJSBridge.invoke(‘getBrandWCPayRequest‘,, function(res) { var msg = res.err_msg; if (msg == "get_brand_wcpay_request:ok") { alert("支付成功,跳转到订单详情页"); location.href = "/order_detail.php"; } else { if (msg == "get_brand_wcpay_request:cancel") { var err_msg = "您取消了微信支付"; } else if (res.err_code == 3) { var err_msg = "您正在进行跨号支付正在为您转入扫码支付......"; } else if (msg == "get_brand_wcpay_request:fail") { var err_msg = "微信支付失败错误信息:" + res.err_desc; } else { var err_msg = msg + "" + res.err_desc; } show_notice(err_msg); } } }
https://www.sucaihuo.com/php/1188.html
https://www.cnblogs.com/fenglingyi/p/4650532.html
标签:团队 typeof sch 相关信息 获取 param done www path
原文地址:https://www.cnblogs.com/shy1766IT/p/12221756.html