I am using PayPalStandard plugin of NopCommerce. When I placed the order & make payment with paypalstandard plugin after successful payment on paypal, it redirects to merchants site. At that time it gives error:
The request was aborted: Could not create SSL/TLS secure channel.
Also I am using Sandbox account of Paypal for testing.
It throws error from this line:
var sw = new StreamWriter(req.GetRequestStream()
Here is code below:
var req = (HttpWebRequest)WebRequest.Create(GetPaypalUrl());
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ProtocolVersion = HttpVersion.Version10;
string formContent = string.Format("cmd=_notify-synch&at={0}&tx={1}", _paypalStandardPaymentSettings.PdtToken, tx);
req.ContentLength = formContent.Length;
using (var sw = new StreamWriter(req.GetRequestStream(), Encoding.ASCII))
sw.Write(formContent);
The error “The request was aborted: Could not create SSL/TLS secure channel.” can happen during any download HTTP request. This error generally will correspond to firewalls, proxies or DNS filtering blocking the connection or an SSL/TLS cipher misconfiguration.
However, the "Could not create SSL/TLS secure channel" error usually means that there's something wrong with the server certificate, e.g. the certificate is for a different hostname, or otherwise invalid, or not trusted etc.
To solve this error, you must ensure . NET Framework is using SSL/TLS 1.1 on Windows settings. There are two options for solving this: editing the Windows registry or reinstalling the . NET Framework.
I had the same issue connecting to sandbox(nvp), everything was fine then yesterday the message "The request was aborted: Could not create SSL/TLS secure channel." appeared.
I believe PayPal updated their endpoints on 19/20 January 2016 to use TSL 1.2 and HTTP 1.1.
To resolve this, for .NET 4.5 and above add the following line of code before calling WebRequest.Create().
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With