首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未获得IPN响应

问未获得IPN响应
EN

Stack Overflow用户
提问于 2014-03-25 14:51:13
回答 2查看 529关注 0票数 0

成功付款后,它将我重定向到成功的URL,但我没有从IPN得到响应。

以下是notifypage.aspx.cs页面代码:

代码语言:javascript
复制
protected void Page_Load(object sender, EventArgs e)
{

    //Post back to either sandbox or live
    string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr";
    // string strLive = "https://www.paypal.com/cgi-bin/webscr";
    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox);

    //Set values for the request back
    req.Method = "POST";
    req.ContentType = "application/x-www-form-urlencoded";
    byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
    string strRequest = Encoding.ASCII.GetString(param);
    strRequest += "&cmd=_notify-validate";
    req.ContentLength = strRequest.Length;

    //for proxy
    //WebProxy proxy = new WebProxy(new Uri("http://url:port#80"));
    //req.Proxy = proxy;

    //Send the request to PayPal and get the response
    StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
    streamOut.Write(strRequest);
    streamOut.Close();
    StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream());
    string strResponse = streamIn.ReadToEnd();
    streamIn.Close();


    if (strResponse == "VERIFIED")
    {

        File.WriteAllText(HttpContext.Current.Server.MapPath("~") + @"\Notify.txt", "Student1111" + Environment.NewLine + "----------------------------------------" + Environment.NewLine);
    }
    else if (strResponse == "INVALID")
    {
        File.WriteAllText(HttpContext.Current.Server.MapPath("~") + @"\Notify.txt", "Problem with payment : " + Environment.NewLine + "----------------------------------------" + Environment.NewLine);
    }
    else
    {
        File.WriteAllText(HttpContext.Current.Server.MapPath("~") + @"\Notify.txt", "not any" + Environment.NewLine + "----------------------------------------" + Environment.NewLine);
    }
}

所以请告诉我怎样才能找回IPN的回复?

EN

回答 2

Stack Overflow用户

发布于 2014-03-25 19:59:09

您应该在此处测试IPN Listner的工作情况

https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNTesting/

票数 0
EN

Stack Overflow用户

发布于 2014-03-25 15:34:29

贝宝IPN响应只调用服务器域,如果您尝试它在本地主机上,它将不会调用您的通知url页面。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22627306

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档