微信支付----維權接口開發!(轉掌眼)

最近比較忙,沒多少時間寫!因此這篇可能比較亂,請理解。。html

1.你需肯定維權URL通知地址;web

   在「商戶功能→商戶信息→修改→維權通知URL」查看維權通知URL。(區分大小寫)api

   

2.添加用戶維權入口服務器

  在服務號自定義菜單添加名稱叫「維權」的菜單,該菜單不分層級,不分位置,微信自動跳轉到維權頁面。。微信

3.獲取維權通知XML數據。app

  在ResponseHandler類(微信支付----沒我想的那麼難)添加獲取XML參數的方法:微信支付

 /**獲取XML參數**/
        public string getMpParameter(string parameter) {
            string s = (string)xmlMap[parameter];
            return (null == s) ? "" : s;
        }

在URL通知頁面獲取數據: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.申請消除投訴spa

 如您已經跟客戶達成一致,可申請消除用戶投訴!code

複製代碼
/// <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 你們能夠一塊兒交流

相關文章
相關標籤/搜索