Solve “Unable To Communicate With The PayPal Gateway” Error In Magento

by admin

For all Magento stores, Paypal is the most popular payment method between store owners and customers. However, there is a prevalent problem that a lot of Magento sites have been facing is the error “Unable to communicate with the PayPal gateway” when checking out by Paypal. This problem causes difficulties for customers to complete their checkout process and it can make customers leave their cart without checking out, and of course, this will increase abandoned cart rates for stores. Therefore, we need to find the best solutions for the error as soon as possible otherwise we have to put up with losses of revenue and customer satisfaction.

To solve this issue, you can follow these instructions as below:

1. Disable SSL verification

You go to the Magento backend,  then choose rSystem-> Configuration-> Payment Methods and find PayPal Express Checkout

alt="paypal-in-magento-backend"

You click to “Configure” button, then expand “Advanced settings” section and you’ll see “Enable SSL verification” option that you need to disable. Let’s turn it to “No.”
alt="enable-SSL-verification-magento-backend"

2. In Sanbox mode

The reason is that Paypal has removed the support to protocol lower than tls 1.2 for their sandboxes. Therefore, you should update your curl and libcurl packages and specify the version in the Magento code: CURL_SSLVERSION_TLSv1_2 (6)

Firstly, you have to disable SSL verification

Secondly, you update the curl library from 7.19 to 7.40 (or later version) by running the following command  from ssh:

curl -v -s https://api-3t.sandbox.paypal.com/nvp

Sometimes, if the server does not run (SSL error), you can follow this question in Stackoverflow.com to update curl library:

http://stackoverflow.com/questions/28495444/how-to-upgrade-php-curl-to-version-7-36-0

Besides, in case you don’t have the access permission to update curl, use this hotfix:

You open: app/code/core/Mage/Paypal/Model/Api/Nvp.php

In line 945, you make the change in the Paypal Nvp module instead of the libraries by finding:

try {
$http = new Varien_Http_Adapter_Curl();


After that, you insert the following code snippet to this line:

$http->addOptions(array(CURLOPT_SSLVERSION => 6));


Finally, you have solved the “Unable to communicate with the PayPal gateway” error when checking out by Paypal in Magento” and your customers can checkout successfully without any obstacles.

If you are still confused about this tutorial, please contact us for more explanation and detailed instructions. We contain talented developer in Web development and Magento extensions which are always willing to support you.

References:

  1. http://stackoverflow.com/questions/35087951/paypal-sandbox-exception-unable-to-communicate-with-the-paypal-gateway-magento
  2. http://magento.stackexchange.com/questions/99411/m1-tls-1-2-paypal-express-nvp-curl-connection-error-35-ssl-connect-error

Next Reading Suggestions

© 2019 BSS Commerce owned by THANH CONG INTER ., JSC. All Rights Reserved.
Business registration certificate no. 0106064469 issued by Hanoi Department of Planning and Investment on 19 December 2019.
Legal Representative: Mr. Nguyen Quang Trung.