It was working well before a week but now it shows following error. I have tried the following things but of no use.
ServicePointManager.Expect100Continue =
Add the following code to your global.asax or before calling the (HttpWebRequest)WebRequest.Create(url);
protected void Application_Start()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// ...
}
This was caused because PayPal are changing their encryption to TLS instead of SSL. This has already been updated on the Sandbox environments but not yet on the live.
Read more: https://devblog.paypal.com/upcoming-security-changes-notice/