2015-07-23 10:06:07,848 INFO -SaleAction.wechat_paymentResult
微信支付后台通知结果:{}
2015-07-23 10:06:07,848 INFO -微信支付后台通知结果:
微信支付后台通知结果:{}
2015-07-23 10:06:07,849 INFO -微信支付后台通知结果:
微信支付后台通知结果:{}
2015-07-23 10:06:07,849 INFO -微信支付后台通知结果:
2015-07-23 10:06:07,849 INFO -微信支付后台通知结果:
微信通知:
后台代码:
System.out.println("微信支付后台通知结果:"+request.getParameterMap());
InputStream inputStream = request.getInputStream();
String requestXml = IOUtils.toString(request.getInputStream(),request.getCharacterEncoding());
logger.info("微信支付后台通知结果:"+requestXml);
ActionContext cxt = ActionContext.getContext();
HttpServletRequest req = (HttpServletRequest) cxt.get(ServletActionContext.HTTP_REQUEST);
System.out.println("微信支付后台通知结果:"+req.getParameterMap());
String reque = IOUtils.toString(req.getInputStream(),req.getCharacterEncoding());
logger.info("微信支付后台通知结果:"+reque);
HttpServletRequest re = ServletActionContext.getRequest();
System.out.println("微信支付后台通知结果:"+re.getParameterMap());
String rq = IOUtils.toString(re.getInputStream(),re.getCharacterEncoding());
logger.info("微信支付后台通知结果:"+rq);
看一下是不是因为网址格式问题,
这样的notify_url :http://www.a.com/index.php?/wechat/notify
微信是通知发送到这来:http://www.a.com/index.php 所以没法收到信息!
我的notify_url :
http://10.1.16.188/ess-online/wechat/wechat_paymentResult
回调:
if(res.err_msg == "get_brand_wcpay_request:ok") { // 表示支付成功
wechatResult();
// paymentNotify();
}if(res.err_msg == "get_brand_wcpay_request:fail"){ // 支付失败
window.location = contentRootPath + "/wechat_paymentFail" ;
}
}
);
}
//function paymentNotify(){
function wechatResult(){
alert("支付成功!");
$.ajax({
url:contentRootPath + "/wechat_paymentResult",
data:{},
type:"POST",
dataType:"text",
error:function(){
modal_alert({content:'微信支付发生异常',btn:'稍后重试'});
},
success:function(data){
alert("支付成功!");
}
});
}
你先要在微信公众平台的微信支付里设置获取notify通知的URL地址,特别的,如果你是做平台,要带上商家参数。
做一个接口,每次收到notify的时候获取xml写下log,然后解析成数组处理数据。