|
WEX5 v3.2.1
仿外卖微信支付,微信开放平台已申请移动应用ID,微信支付已获取,appsecret已重置,应用签名已修改,
打包发布到Andriod手机,选择微信支付总是提示:"微信支付失败!-11FAIL",说明generatePrepayId不成功。
代码如下:
Model.prototype.payOrderByWeixin = function(payDtd, orderID) {
var notifyUrl = location.origin;
justep.Util.hint("Url=" + notifyUrl);
// alert("url=" + notifyUrl);
if (!navigator.weixin) {
payDtd.reject(-13);
return;
}
var traceID = justep.UUID.createUUID();
var traceNo = justep.UUID.createUUID();
var payMoney = this.getElementByXid("payMoneyTxt").value;
// alert('payMoney=' + payMoney)
var weixin = navigator.weixin;
weixin.generatePrepayId({
"body" : "美食在线",
"feeType" : "1",
"notifyUrl" : notifyUrl,
"totalFee" : "1",
"traceId" : traceID,
"tradeNo" : traceNo
}, function(prepayId) {
weixin.sendPayReq(prepayId, function(message) {
var responseCode = parseInt(message);
if (responseCode === 0) {
payDtd.resolve(1);
updateDD(traceNo);
} else if (!isNaN(responseCode)) {
payDtd.reject((-13) + responseCode);
} else {
payDtd.reject(-10);
}
}, function(message) {
justep.Util.hint("微信支付失败!-10" + message);
payDtd.reject(-10);
});
}, function(message) {
justep.Util.hint("微信支付失败!-11" + message);
payDtd.reject(-11);
});
};
|
|