【发布时间】:2013-05-18 14:04:37
【问题描述】:
根据paypal document,当我们使用 IPN 将消息发送回 Paypal 后,我们会返回:-
PayPal will then send one single-word message, VERIFIED, if the message is valid; otherwise, it will send another single-word message, INVALID.
但是我时不时注意到即使付款成功,响应也可能是空白的。有没有其他人注意到这一点?
我要验证的代码是:-
var req = (HttpWebRequest)WebRequest.Create(Settings.PayPalPaymentUrl);
//Set values for the request back
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] param = Request.BinaryRead(Request.ContentLength);
strRequest = Encoding.ASCII.GetString(param);
strRequest += "&cmd=_notify-validate";
req.ContentLength = strRequest.Length;
//Send the request to PayPal and get the response
var streamOut = new StreamWriter(req.GetRequestStream(), Encoding.ASCII);
streamOut.Write(strRequest);
streamOut.Close();
var streamIn = new StreamReader(req.GetResponse().GetResponseStream());
strResponse = streamIn.ReadToEnd();
streamIn.Close();
99% 的案例我收到了VERIFIED,但我们时不时地看到一条空消息。
【问题讨论】:
标签: c# paypal paypal-ipn