【发布时间】:2012-10-08 11:14:58
【问题描述】:
我们如何使用Paypal Payflow pro帐户在同一网站返回扣除金额?
我正在为我的一个应用程序使用 Paypal Payflow 专业帐户。它进行交易但不返回扣除金额的详细信息。我第一次使用 Paypal Payflow 帐户。所以如果有人之前做过这样的工作,请与我分享。
【问题讨论】:
我们如何使用Paypal Payflow pro帐户在同一网站返回扣除金额?
我正在为我的一个应用程序使用 Paypal Payflow 专业帐户。它进行交易但不返回扣除金额的详细信息。我第一次使用 Paypal Payflow 帐户。所以如果有人之前做过这样的工作,请与我分享。
【问题讨论】:
您好,我已经这样做了,任何需要解决方案的人请参见下文:
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;
}
【讨论】:
转到您的 PayPal 商家帐户-->个人资料-->销售偏好-->网站支付偏好-->网站支付的自动退货将单选按钮打开,默认应该关闭。交易后确保该值是存储在您的数据库中。我希望这对您有所帮助
【讨论】: