asp.net - 我们如何使用 Paypal Payflow pro 帐户在同一网站退还金额

标签 asp.net paypal

我们如何使用 Paypal Payflow pro 帐户在同一网站退还扣除金额?

我正在为我的一个应用程序使用 Paypal Payflow pro 帐户。它进行交易但不返回扣除金额详细信息。我是第一次使用 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;
    }

关于asp.net - 我们如何使用 Paypal Payflow pro 帐户在同一网站退还金额,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12947155/

相关文章:

Paypal 移动 SDK - 单一付款交易不会在仪表板的交易选项卡中更新

php - PayPal自适应支付链式支付错误

asp.net mvc - 在 Razor 中提供交替行样式的最简单方法

c# - 向 ASP 控件添加自定义事件

jquery - 如何在嵌套转发器内触发链接按钮的 OnClick 事件

ios - PayPal 与 IOS swift 集成

paypal - PayPal MEC 库是否已弃用或停产?

javascript - 在javascript函数中如何修改 session 变量

asp.net - 获取gridview中的列索引值

java - Paypal PDT 返回 HTTP 状态 307