wxPayInvoke(payRes, openid) {
var url = window.location.href;
let that = this
wx.config({
debug: false,
appId: payRes.data.appId,
timestamp: payRes.data.timeStamp,
nonceStr: payRes.data.nonceStr,
signature: payRes.data.paySign,
jsApiList: ['chooseWXPay'],
openId: openid
});
wx.ready(function() {
wx.chooseWXPay({
appId: payRes.data.appId,
timeStamp: payRes.data.timeStamp,
nonceStr: payRes.data.nonceStr,
package: payRes.data.packageVal,
signType: 'RSA',
paySign: payRes.data.paySign,
success: function(res) {
uni.showToast({
icon: 'none',
title: '支付成功'
})
},
cancel: function(res) {
setTimeout(() => {
uni.showToast({
icon: 'none',
title: '已取消支付'
})
}, 2000)
},
fail: function(res) {
uni.showToast({
icon: 'none',
title: '支付失败,请重试'
})
}
});
});
},
上述是我uniapp的代码
下面是java的
com.wechat.pay.java.service.payments.jsapi.model.PrepayRequest request = new PrepayRequest();
String orderNo = getOrderNo();
Integer totalAmountInFen = convertYuanToFen(totalAmount);
com.wechat.pay.java.service.payments.jsapi.model.Amount amount = new Amount();
amount.setTotal(totalAmountInFen);
amount.setCurrency("CNY");
request.setAmount(amount);
request.setAppid(wxPayProperties.getAppId());
request.setMchid(wxPayProperties.getMchId());
com.wechat.pay.java.service.payments.jsapi.model.Payer payer = new Payer();
payer.setOpenid(openid);
request.setPayer(payer);
request.setDescription(tPaidGroup.getGroupContent());
request.setGoodsTag(tPaidGroup.getGroupName());
request.setNotifyUrl(wxPayProperties.getNotifyUrl());
request.setOutTradeNo(orderNo);
PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);
return response;
之后提示我

换WeixinJSBridge.invoke方法