PayPal IPN https更改2016 [英] PayPal IPN https changes 2016

查看:303
本文介绍了PayPal IPN https更改2016的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天从PayPal收到信息:

Received information today from PayPal:

IPN验证回传到HTTPS


如果您使用的是PayPal的即时付款通知(IPN)服务,则需要确保在将消息发回PayPal以进行>验证时使用HTTPS。 2016年9月30日之后,将不再支持HTTP回发。

If you are using PayPal’s Instant Payment Notification (IPN) service, you will >need to ensure that HTTPS is used when posting the message back to PayPal for >verification. After Sept 30, 2016 HTTP postbacks will no longer be supported.

我正在使用IPN并且实时网站正在运行但我们的DEV IPN正在使用沙箱的监听器: https://www.sandbox.paypal.com/cgi -bin / webscr 坏了。

I am using IPN and the live site is working but our DEV IPN listener which is using the sandbox at: https://www.sandbox.paypal.com/cgi-bin/webscr is broken.

我很困惑我需要做些什么来修复它。我加入此代码与收听页面加载,而无需再次错误

I am confused about what I need to do to fix it. I added this code and the listener page loads without error again.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                | SecurityProtocolType.Tls11
                | SecurityProtocolType.Tls12
                | SecurityProtocolType.Ssl3;

            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

但是当我尝试测试一个事务时,监听器永远不会从PayPal收到任何信息。这是因为监听器的服务器现在必须是https吗?
PP沙箱现在拒绝通知非SSL地址吗?

But when I try to test a transaction the listener never receives anything from PayPal. Is this because the server of the listener now has to be "https"? Does PP sandbox now refuse to notify a non SSL address?

我最初从PayPal示例获得了我的c#代码,但它已不在他们的网站上。

I got my c# code originally from a PayPal example but it is no longer on their site.

var useSandbox = Convert.ToBoolean(ConfigurationManager.AppSettings["UsePayPalSandboxYn"]);
var server = useSandbox ? "https://www.sandbox.paypal.com/cgi-bin/webscr" : "https://www.paypal.com/cgi-bin/webscr";

var req = (HttpWebRequest)WebRequest.Create(server);

// set values for the request back
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";

//added today
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls
                | SecurityProtocolType.Tls11
                | SecurityProtocolType.Tls12
                | SecurityProtocolType.Ssl3;

ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };


byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
var 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());
string strResponse = streamIn.ReadToEnd();
streamIn.Close();

switch (strResponse)
{
case "VERIFIED":
                {

我使用静态IP地址和家庭路由器设置为Web服务器进行调试。如果我必须设置ssl,那将会更加困难。

I do my debugging with a static IP address and a home router set up as a web server. It's going to be even harder if I have to set up ssl.

有人能指出我正确的方向吗?

Can anyone point me in the right direction?

推荐答案

您唯一需要做的就是确保将验证POST发送回PayPal,而不是http://。您无需在站点上安装SSL即可运行IPN侦听器。

The only thing you need to do is make sure you're sending your verification POST back to PayPal to https:// instead of http://. You don't have to have an SSL installed on your site for your IPN listener to run on.

这篇关于PayPal IPN https更改2016的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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