标签:
最近比较忙,没多少时间写!所以这篇可能比较乱,请理解。。
1.你需确定维权URL通知地址;
在“商户功能→商户信息→修改→维权通知URL”查看维权通知URL。(区分大小写)
2.添加用户维权入口
在服务号自定义菜单添加名称叫“维权”的菜单,该菜单不分层级,不分位置,微信自动跳转到维权页面。。
3.获取维权通知XML数据。
在ResponseHandler类(微信支付----没我想的那么难)添加获取XML参数的方法:
/**获取XML参数**/ public string getMpParameter(string parameter) { string s = (string)xmlMap[parameter]; return (null == s) ? "" : s; }
在URL通知页面获取数据:
if (!IsPostBack) { //创建支付应答对象 ResponseHandler resHandler = new ResponseHandler(Context); resHandler.init(); resHandler.setKey(TenpayUtil.key, TenpayUtil.appkey); //判断签名 if (resHandler.isWXsignfeedback()) { string AppId = resHandler.getMpParameter("AppId"); string TimeStamp = resHandler.getMpParameter("TimeStamp"); string OpenId = resHandler.getMpParameter("OpenId"); string AppSignature = resHandler.getMpParameter("AppSignature"); string MsgType = resHandler.getMpParameter("MsgType"); string FeedBackId = resHandler.getMpParameter("FeedBackId"); string TransId = resHandler.getMpParameter("TransId"); string Reason = resHandler.getMpParameter("Reason"); string Solution = resHandler.getMpParameter("Solution"); string ExtInfo = resHandler.getMpParameter("ExtInfo"); string SignMethod = resHandler.getParameter("SignMethod"); string txt = string.Empty; if (MsgType.ToLower().Trim() == "request") { //新增维权操作 } else { //用户确认处理完毕操作 } //回复服务器处理成功 Response.Write("OK"); Response.Write("OK:" + resHandler.getDebugInfo()); } else { //sha1签名失败 Response.Write("fail"); Response.Write("fail:" + resHandler.getDebugInfo()); } Response.End(); }
4.申请消除投诉
如您已经跟客户达成一致,可申请消除用户投诉!
/// <summary> /// 向微信发送撤销投诉申请 /// </summary> /// <returns></returns> private void MessageToTx(string accessToken, string openId, string feedBackId) { string url = "https://api.weixin.qq.com/payfeedback/update?access_token={0}&openid={1}&feedbackid={2}"; url = string.Format(url, accessToken, openId, feedBackId); HttpWebRequest webRequest2 = (HttpWebRequest)WebRequest.Create(url); webRequest2.ContentType = "text/html; charset=UTF-8"; webRequest2.Method = "GET"; webRequest2.UserAgent = "Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"; HttpWebResponse httpWebResponse2 = (HttpWebResponse)webRequest2.GetResponse(); StreamReader swRead = new StreamReader(httpWebResponse2.GetResponseStream(), System.Text.Encoding.GetEncoding("UTF-8")); Write(swRead.ReadToEnd()); }
至此维权接口已经开发完成,可申请全网支付,注意开启全网支付,不受白名单限制!
群号:87742911 大家可以一起交流
标签:
原文地址:http://www.cnblogs.com/toosuo/p/4397683.html