安卓微信支付是没有问题的,就ios的端使用微信支付没有任何反应,什么错也没报。
首先:既然安卓能微信支付说明后台返回的参数是没有问题的
其次:ios就比安卓多了一个通用链接,我确定通用链接配置是没有问题的。
目前就完全不知道为什么ios端的微信支付会不行,一点反应都没有,也没有报错。这个问题已经卡了几天了,哪位大佬能指教一下哦。

- 发布:2019-12-13 18:30
- 更新:2025-01-22 11:15
- 阅读:4861
【求助】uni-app ios端无法唤起微信支付

appid和package直接写确认的值,不用返回的结果值,其他返回值都是string类型,我这边这样改是可以了。这个问题也困扰我好几天,各种配置都排查了好几遍,没想到这样改成功了,-_-||,希望能帮助到大家
orderInfo: {
appid: "wx2******ad2f4",
noncestr: String(this.massageData.noncestr),
package: "Sign=WXPay", // 固定值
partnerid: this.massageData.partnerid, // 微信支付商户号
prepayid: this.massageData.prepayid, // 统一下单订单号
timestamp: this.massageData.timestamp, // 时间戳(单位:秒)
sign: String(this.massageData.sign), // 签名,这里用的 MD5 签名
},

1***@qq.com - 90后
ios端支付界面首次进入的时候不会更改url,导致与公众号接口url不一致,我的解决方法是在支付的时候加一个平台判断:
if(uni.getSystemInfoSync().platform==="ios"){
uni.setStorageSync('reload','true');
location.reload();
}
当然还有本地存储付款信息;
然后在onload里面判断是否是ios重载的页面,重新付款,这时候url就正确了:
if(uni.getStorageSync('reload')=='true'){
uni.setStorageSync('reload','');
that.submit();
}

1***@qq.com - 90后
究极解决办法:
if (location.href.indexOf('?#') < 0) {
location.href = location.href.replace('#', '?#')
}

1、安卓支付调通
2、IOS微信登陆/分享功能成功
3、微信支付不报错也不调起
console.log("prepay",1)
uni.requestPayment({
provider: 'wxpay',
orderInfo: {
sign: res.data.sign,
prepayid: res.data.prepayId,
partnerid: res.data.partnerId,
appid: res.data.appId,
packagevalue: res.data.packageValue,
timestamp: res.data.timeStamp,
noncestr: res.data.nonceStr
},
success:(res) => {
getApp().showToast("支付成功", 'success')
console.log("prepay","success", JSON.stringify(res))
res.orderId = orderId
uni.report('buyBbSuccess', JSON.stringify(res))
this.reqPayStatus(orderId)
this.dismiss()
},
fail: function(err) {
console.log('fail:' + JSON.stringify(err));
uni.report('buyBbFailWx', JSON.stringify(err))
},
complete:(com)=>{
console.log('complete' + JSON.stringify(com));
}
});
console.log("prepay",2)
prepay1和prepay2都打印了,支付中的success和fail、complete都不执行
【====================求救==================】
已解决,由于package在java中时保留字,后端返回packageValue,所以我以为就时叫这名字,关键是,安卓竟然过了

发起支付的orderInfo中的参数都是必填项,且参数名必须全小写,否则ios无法触发uni.requestPayment
API。
//订单对象,从服务器获取
var orderInfo = {
"appid": "wx499****7c70e", // 应用ID(AppID)
"partnerid": "148*52", // 商户号(PartnerID)
"prepayid": "wx202254****fbe90000", // 预支付交易会话ID
"package": "Sign=WXPay", // 固定值
"noncestr": "c5sEwbaNPiXAF3iv", // 随机字符串
"timestamp": 1597935292, // 时间戳(单位:秒)
"sign": "A842B45937F6EFF60DEC7A2EAA52D5A0" // 签名,这里用的 MD5 签名
};

// 大坑
const os = uni.getSystemInfoSync().osName
if (os === 'android') {
orderInfo['nonceStr'] = data.nonceStr
} else {
orderInfo['noncestr'] = data.nonceStr
}
d***@126.com
就是这个原因
2025-01-22 11:16