1

我们如何使用 Paypal Payflow 专业帐户在同一网站返回扣除金额?

我正在为我的一个应用程序使用 Paypal Payflow 专业帐户。它进行交易但不返回扣除金额的详细信息。我第一次使用 Paypal Payflow 帐户。因此,如果有人在此之前做过此类工作,请与我分享。

4

2 回答 2

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;
    }
于 2012-10-19T04:47:41.257 回答
0

转到您的 PayPal 商家帐户--> 个人资料--> 销售偏好--> 网站支付偏好--> 网站支付的自动退货将单选按钮打开,默认它应该关闭。交易后确保价值存储在您的数据库。我希望这对你有帮助

于 2012-10-18T13:42:45.900 回答