后端使用的是微信支付apiv3
updateNow() {
let _this = this;
appPlaceAnOrder(obj).then((res)=>{
let objData = res.data
let orderInfox = {
"appId": objData.appid, // 应用ID(AppID)objData.appid
"noncestr": objData.noncestr, // 随机字符串
"package": objData.package, // 固定值 objData.package
"partnerid": objData.partnerid, // 商户号(PartnerID) objData.partnerid
"prepayid": objData.prepayid, // 预支付交易会话ID
"timestamp": objData.timestamp, // 时间戳(单位:秒) Number(timestamp)
"sign": objData.sign, // 签名
};
uni.requestPayment({
"provider": "wxpay", //固定值为"wxpay"
"orderInfo": JSON.stringify(orderInfox),
"timeStamp": JSON.stringify(objData.timestamp),
"nonceStr": objData.noncestr,
"package": objData.package,
"signType": "RSA",
"paySign": objData.sign,
success: function (res) {
var rawdata = JSON.parse(res.rawdata);
console.log("支付成功");
},
fail: function (err) {
console.log('支付失败:' + JSON.stringify(err));
}
});
})
},
前端代码是这样的。
接口返回:
"package": "Sign=WXPay",
"paySign": "39ee946c1d50ac5424**",
"appid": "wxfd325",
"sign": "UGO0mSbSBLrR4j4BBDz0/YZjwlo+fzhRA1H6AKF5Xb2dg1bbtov2xe5U1+cb1ql3B1j4YOwnHva+vOFk6Io4Uw9lqdhXIwQfl7ka/dNpLBLPBeDEsa9WCVFFpMdQjcOMY1YClfnubLUfUGCgeinb+MRdgJ5P42PcYp2bxIUm6VKmJwDEQ/P6HCpgSPDwU/zXG1KPj7uACMWKnNQ9YzoVE2uOXqNvgpNUL5Fh7iU+bPwN1PUQMpZ9h0wvBi7n4jc33ycGs0rwXrdzHCyPlnV7DrjnjXGolDsBBJ1uAS/k3v5c+NKBEXYkY4AczQ3v3TJcnk5sUPTNOKCWdSqBXK2xvw==",
"partnerid": "15812",
"prepayid": "wx25143828099744f6059**",
"noncestr": "eKJvggxtrGAvB4mshGy7JgZGG5pQmLlS",
"timestamp": "1714027106"
现象:第一次调起支付成功,后面的都报错:
支付失败:{"errMsg":"requestPayment:fail [payment微信:-1]General errors","errCode":-100,"code":-100}
求指教哪里有问题。卡了5天了。
2 个回复
g***@qq.com - 广西共创未来加科技有限公司
我也是,但是返回的不是-1 是-2 提示:支付验证签名失败
jgj_app
orderInfo 不同平台 类型不一样
jgj_app
provider uni.getProvider 获取
2024-08-15 15:08