7

Hi I am using Paypal PHP SDK to communicate with Paypal Api.

2 days before every thing was working fine. But now I am getting this error on my development servers.

error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure

I am using the following CURL options while requesting:

public static $DEFAULT_CURL_OPTS = array(
    CURLOPT_SSLVERSION => 1,
    CURLOPT_CONNECTTIMEOUT => 10,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_TIMEOUT        => 60,   // maximum number of seconds to allow cURL functions to execute
    CURLOPT_USERAGENT      => 'PayPal-PHP-SDK',
    CURLOPT_HTTPHEADER     => array(),
    CURLOPT_SSL_VERIFYHOST => 2,
    CURLOPT_SSL_VERIFYPEER => 1,
    CURLOPT_SSL_CIPHER_LIST => 'TLSv1',
);

This problem only occuring using SANDBOX mode on live mode every thing works fine.

Any body knows why this is happening?

Thank You

Muhammad Umair
  • 393
  • 1
  • 7
  • 20
  • May be these links can help you....http://stackoverflow.com/questions/26385603/facebook-sdk-for-php-error-curlexception-35-error14094410ssl-routinesssl3 2..http://stackoverflow.com/questions/26379773/paypal-ipn-acknowledgements-failing-with-ssl-routinesssl3-read-bytessslv3-aler – Aamir Sarwar Feb 02 '16 at 06:06

1 Answers1

3

I've experienced the same error. It's due to recent updates that PayPal have made: https://www.paypal-knowledge.com/infocenter/index?page=content&id=FAQ1766

You can fix it by adding this to your CURL options:

curl_setopt($ch, CURLOPT_SSLVERSION , 1);

or

CURLOPT_SSL_SSLVERSION => 1

EDIT: Complete working settings

curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
curl_setopt($ch, CURLOPT_SSLVERSION , 1);
Jaz Parkyn
  • 186
  • 1
  • 11
  • Hi, Thank You for your reply but I have already tried this. I think according to the link you have given I have to update my server. – Muhammad Umair Jan 26 '16 at 14:20
  • I'm not sure that you, try removing this: CURLOPT_SSL_CIPHER_LIST => 'TLSv1' and adding CURLOPT_SSL_SSLVERSION => 1 – Jaz Parkyn Jan 26 '16 at 14:56