×

微信支付 总提示get_brand_wcpay_request:fail 也不跳转支付页面 的解决方案

admin admin 发表于2016-07-21 13:52:11 浏览2371 评论0

抢沙发发表评论

最近在做微信支付,帮客户部署好环境后,测试微信支付,发现点击支付后老是提示:

get_brand_wcpay_request:fail,

于是找到代码中调用微信支付的代码段:

WeixinJSBridge.invoke('getBrandWCPayRequest', {
                            'appId': wechat.appid ? wechat.appid : wechat.appId,
                            'timeStamp': wechat.timeStamp,
                            'nonceStr': wechat.nonceStr,
                            'package': wechat.package,
                            'signType': wechat.signType,
                            'paySign': wechat.paySign,
                        }, function (res) {
                            if (res.err_msg == 'get_brand_wcpay_request:ok') {
                                core.json('order/pay', {
                                    op: 'complete',
                                    orderid: '{$_GPC['orderid']}',
                                    type: 'weixin', deduct: deduct
                                }, function (pay_json) {
                                    if (pay_json.status == 1) {

                                        $('#container').html(tpl('tpl_order_pay', pay_json.result));
                                        return;
                                    }
                                    core.tip.show(pay_json.result);
                                    $('.button').removeAttr('submitting');
                                }, true, true);
                            } else if (res.err_msg == 'get_brand_wcpay_request:cancel') {
                                $('.button').removeAttr('submitting');
                                core.tip.show('取消支付');
                            } else {
                                $('.button').removeAttr('submitting');
                                alert(JSON.stringify(res));
                                alert(res.err_msg);
                            }
                        });
 alert(JSON.stringify(res));

,主要用来查看返回的详细信息,信息提示我是我当前域名没有在微信支付配置中授权,登录微信公众号平台,在微信支付中配置下授权目录,

blob.png

分享到:

群贤毕至

访客