/**
* 微信支付
* @link https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6
*/
var wxPay = {
to: function() {
if (typeof WeixinJSBridge == "undefined"){
if( document.addEventListener ){
document.addEventListener('WeixinJSBridgeReady', wxPay._onBridgeReady, false);
}else if (document.attachEvent){
document.attachEvent('WeixinJSBridgeReady', wxPay._onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', wxPay._onBridgeReady);
}
}else{
wxPay._onBridgeReady();
}
},
ok: function(ctx) {
console.log(ctx);
},
cancel: function(ctx) {
console.log(ctx);
},
fail: function(ctx) {
console.log(ctx);
},
other: function(ctx) {
console.log(ctx);
},
brandWCPayRequest:{
appId:'',//公众号名称,由商户传入
timeStamp:'',//时间戳,自1970年以来的秒数
nonceStr:'',//随机串
package:'', //订单详情扩展字符串
signType:'',//微信签名方式
paySign:'',//微信签名
},
_onBridgeReady: function () {
try {
WeixinJSBridge.invoke('getBrandWCPayRequest', wxPay.brandWCPayRequest, function(res) {
switch (res.err_msg) {
case 'get_brand_wcpay_request:ok': //支付成功
wxPay.ok({
result: res,
param: wxPay.brandWCPayRequest
});
break;
case 'get_brand_wcpay_request:cancel': //支付过程中用户取消
wxPay.cancel({
result: res,
param: wxPay.brandWCPayRequest
});
break;
case 'get_brand_wcpay_request:fail': // 支付失败
wxPay.fail({
result: res,
param: wxPay.brandWCPayRequest
});
break;
default:
wxPay.other({
result: res,
param: wxPay.brandWCPayRequest
});
}
});
}catch (e) {
wxPay.other({
exception:e.toString(),
param: wxPay.brandWCPayRequest
});
}
}
};
以上是我的支付js,偶尔会发生异常:system:function_not_implement,请问是为什么呢
微信内pc浏览器端网页上调起微信支付是会稳定发生该报错。手机端没问题
解决了吗
没有解决,无解。
您好,你调起支付请求的参数发出来,还有你获取的参数prepayid发出来我查下,谢谢!
{
"appId": "wx************",
"timeStamp": "1560998297",
"nonceStr": "1038171855",
"package": "prepay_id=wx201038178876331189218ca91620886000",
"signType": "MD5",
"paySign": "62A1D6BA8F325C01F528CAC445B2901E"
}