2012-10-18 42 views
1

如何使用Paypal Payflow專業版賬戶在同一網站上返回扣除金額?我們如何使用Paypal Payflow專業版賬戶返回金額

我使用我的應用程序之一的貝寶Payflow專業帳戶。它做交易但不退還扣除金額的細節。我使用的是第一次使用Paypal Payflow帳戶。因此,如果有人在與我分享之前做了這樣的工作。

回答

1

嗨,我已經做到了這一點,有人見下文:

protected NameValueCollection httpRequestVariables() 
{ 
    var post = Request.Form;  // $_POST 
    var get = Request.QueryString; // $_GET 
    return Merge(post, get); 
} 

if (!IsPostBack) 
    { 
     string output = ""; 
     if (httpRequestVariables()["RESULT"] != null) 
     { 
      HttpContext.Current.Session["payflowresponse"] = httpRequestVariables(); 
      output += "<script type=\"text/javascript\">window.top.location.href = \"" + url + "\";</script>"; 
      BodyContentDiv.InnerHtml = output; 
      return; 
     } 

var payflowresponse = HttpContext.Current.Session["payflowresponse"] as NameValueCollection; 
      if (payflowresponse != null) 
      { 
       HttpContext.Current.Session["payflowresponse"] = null; 

       bool success = payflowresponse["RESULT"] == "0"; 
       if (success) 
       { 
        output += "<span style='font-family:sans-serif;font-weight:bold;'>Transaction approved! Thank you for your order.</span>"; 
       } 
       else 
       { 
        output += "<span style='font-family:sans-serif;'>Transaction failed! Please try again with another payment method.</span>"; 
       } 


       output += "<p>(server response follows)</p>\n"; 
       output += print_r(payflowresponse); 

       AdvancedDemoContent.InnerHtml = output; 


public string print_r(Object obj) 
    { 
     string output = "<pre>\n"; 
     if (obj is NameValueCollection) 
     { 
      NameValueCollection nvc = obj as NameValueCollection; 

      output += "RESULT" + "=" + nvc["RESULT"] + "\n"; 
      output += "PNREF" + "=" + nvc["PNREF"] + "\n"; 
      output += "RESPMSG" + "=" + nvc["RESPMSG"] + "\n"; 
      output += "AUTHCODE" + "=" + nvc["AUTHCODE"] + "\n"; 
      output += "CVV2MATCH" + "=" + nvc["CVV2MATCH"] + "\n"; 
      output += "AMT" + "=" + nvc["AMT"] + "\n"; 

     } 
     else 
     { 
      output += "UNKNOWN TYPE"; 
     } 
     output += "</pre>"; 
     return output; 
    } 
0

轉到您的貝寶商家帳戶 - >配置文件 - >銷售首選項 - >網站付款首選項 - >自動返回網站付款將單選按鈕打開,默認它應該off.after交易確保值存儲在您的database.i希望誰需要解決這個幫助你