微信公眾號支付回調頁面處理asp.net


1.在商家微信商戶通中配置回調url
2.在提交訂單時傳入的回調頁面中獲取支付成功后或支付失敗后的參數,對訂單進行處理

protected void Page_Load(object sender, EventArgs e) 
{ 
  //接收維修支付通知頁面 
  Stream s = Request.InputStream; 
  byte[] b = new byte[s.Length]; 
  s.Read(b, 0, (int)s.Length); 
  string result = System.Text.Encoding.UTF8.GetString(b); 
  if (GetXMLInnerText(result, “return_code”) == “SUCCESS”) { 
  //這里沒有驗證簽名 
  string orderId = GetXMLInnerText(result, “out_trade_no”); 
  string appid = GetXMLInnerText(result, “appid”); 
  string bank_type = GetXMLInnerText(result, “bank_type”); 
  // string cash_fee = GetXMLInnerText(result, “cash_fee”); 
  string fee_type = GetXMLInnerText(result, “fee_type”); 
  string mch_id = GetXMLInnerText(result, “mch_id”); 
  string openid = GetXMLInnerText(result, “openid”); 
  string total_fee = GetXMLInnerText(result, “total_fee”); 
  string transaction_id = GetXMLInnerText(result, “transaction_id”); 
  string time_end = GetXMLInnerText(result, “time_end”); 
  /// 對獲取到支付成功的訂單進行處理 
  …… 
  /// 
  //告訴微信收到支付成功果
   Response.Write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>");
s.Flush(); s.Close(); s.Dispose();
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM