Paypal与IPN集成(始终获得无效响应) [英] Paypal integration with IPN (Alway getting INVALID response)

查看:88
本文介绍了Paypal与IPN集成(始终获得无效响应)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的应用程序需要与PayPal进行交互.我使用PTD令牌实现,但是客户端要求IPN(没有PTD的任何东西).以下是我正在使用的代码,但始终得到无效"响应.有人知道为什么吗?请先获得紧急帮助.

Hello All,

My application needs to interact with PayPal. I implemented with PTD Token, but client is asking for IPN (any thing without PTD). Following is the code I am using, but always getting "INVALID" response. Anybody knows why? please I need urgent help, thanks in advance.

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;


       //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();

推荐答案

永远不会接受来自不安全网站的代码来处理任何与真钱有关的事情.
您不知道是谁在给您代码,您不知道它是做什么的,您也不知道它是在没有将详细信息传递给任何第三方的情况下将款项正确地放入适当的帐户中的.

仅从贝宝自己获得这样的代码-否则欺诈的范围就很大.请记住,如果您的行为被视为疏忽大意,您本人应对损失的任何金钱负责-从公共论坛获取您的代码绝对是可以的!
Never, ever, accept code from a insecure website to handle anything to do with real money.
You do not know who is giving you the code, you do not know what it does, you do not know that it places the monies correctly into the appropriate account, without passing the details to any third parties.

Only get such code from paypal themselves - the scope for fraud otherwise is far to large. And remember, you personally could be liable for any monies lost if your action is seen to be negligent - which getting your code from a public forum would most certainly be!


这篇关于Paypal与IPN集成(始终获得无效响应)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆