English 中文(简体)
ASP. NET Paypal IPN Back VERIFIED but IPN Fails to Send
原标题:ASP.NET Paypal IPN returning VERIFIED but IPN Fails to Send

我将努力直截了当。 我目前正在与Pal IPN合作,从未看到过这一问题。 我一直使用Pal IPN,我的执行也一样。 然而,此时此刻,它正在产生一些非常令人厌恶的结果。

我现在与温·霍斯特·科一起接待我。

法典使用:

public void MakeHttpPost()
    {

        ErrorLog log = new ErrorLog();
        //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 = HttpContext.Current.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#"));
        //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();
        log.error = strResponse;
        log.Insert();

        if (strResponse == "VERIFIED")
        {
            PaypalPaymentHistory PPH = new PaypalPaymentHistory();

            PPH.LastName = HttpContext.Current.Request["last_name"];
            PPH.FirstName = HttpContext.Current.Request["first_name"];
            PPH.State = HttpContext.Current.Request["address_state"];
            PPH.Zipcode = HttpContext.Current.Request["address_zip"];
            PPH.Address = HttpContext.Current.Request["address_street"];
            PPH.UserName = HttpContext.Current.Request["option_name2"];
            PPH.PaymentStatus = HttpContext.Current.Request["payment_status"];
            PPH.SelectedPackage = HttpContext.Current.Request["option_selection1"];
            PPH.PayerStatus = HttpContext.Current.Request["payer_status"];
            PPH.PaymentType = HttpContext.Current.Request["payment_type"];
            PPH.PayerEmail = HttpContext.Current.Request["payer_email"];
            PPH.ReceiverId = HttpContext.Current.Request["receiver_id"];
            PPH.TxnType = HttpContext.Current.Request["txn_type"];
            PPH.PaymentGross = HttpContext.Current.Request["payment_gross"];

            PPH.Insert();

        }
        else if (strResponse == "INVALID")
        {
            //log for manual investigation
        }
        else
        {
            //log response/ipn data for manual investigation
        }

    }

这里的想法是,我将检查订单状况,然后在数据库中插入或不添加记录,但该守则仍在测试之中,因此没有正式。

我面临的问题是,当我通过沙箱跑,并通过我的现场支付钱款时,我会发出尼共(毛主义)的请求。 输入数据库后,所有数据都正确退回。 然而,Pal正在表明尼共(毛主义)邮政“失败”,总是被困在“再造”。 然而,我正在恢复“VERIFIED”。 这反过来又导致每笔交易有8个记录。 报到的错误是500个——内部服务器Error。 任何帮助都会得到冷静的赞赏,因为迄今为止,这一直是朝 mar的2天头!

感谢任何帮助或决议。

P.S 我几乎读过每一个尼共(毛主义)问题,并看不到这一点。

最佳回答

Your controller action is failing if PayPal reports a 500. You need to debug that code and see what is failing. If your controller does not send a 200 back, PayPal will keep trying.

我始终这样做:

    public ActionResult IPN()
    {     
        //try catch log all my payment info

        //always return blank page so paypal gets a HTTP 200
        return View();
    }

你们可能知道这一点,但对于其他人来说,这里是一个例子。

  1. Payment/transaction made to PayPal
  2. IPN address is configured for PayPal transaction then posts to the IPN address ie: http://yourdomain.com/IPN.aspx
  3. IPN.aspx handles the IPN post and writes PaypalPaymentHistory to db.
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签