Post by computrav » Mon Jan 15, 2018 11:46 am

This was also not working for me...

I ran that cURL test script and got the following output (IPs masked):

Code: Select all

ERROR (60):
SSL certificate problem: unable to get local issuer certificate
    [url] =>
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 1
    [redirect_count] => 0
    [total_time] => 0.11
    [namelookup_time] => 0.032
    [connect_time] => 0.078
    [pretransfer_time] => 0
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => -1
    [upload_content_length] => -1
    [starttransfer_time] => 0
    [redirect_time] => 0
    [redirect_url] => 
    [primary_ip] => xx.xx.xx.xx
    [certinfo] => Array

    [primary_port] => 443
    [local_ip] => xx.xx.xx.xx
    [local_port] => 58345
Note that I'm getting ERROR 60 whereas others in this thread are getting ERROR 35. In any case, they are both related to SSL issues.

I highly suspected it was due to the use of a self-signed SSL certificate on my dev box. When I ran the PHP script from a PROD server it appears to be successful (ERROR 0). I don't have my OpenCart store setup on the PROD server, however, so I can't verify if things work via the Square Extension from within OpenCart.

When I add the following in the cURL test script (e.g., next to the other curl_setopt() line), the script returns successfully (ERROR 0) on my dev box:

Code: Select all

curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
** This should of course NOT ever be used in any Production capacity, as it is telling cURL to ignore SSL cert issues. **

So, to work around this, here's what I did:

1) I did some Googling and found this page and downloaded the cacert.pem file provided:
2) I modified my php.ini file and added the following as indicated on the page (update the path based on where you saved cacert.pem):

Code: Select all

curl.cainfo = "C:\php\extras\ssl\cacert.pem"
3) Restart apache

After doing the above, the test cURL script returned successfully (ERROR 0) - even without the CURLOPT_SSL_VERIFYPEER workaround.

I was also then able to go back to the Square extension and authenticate and it worked! I received the green box message, "Successfully refreshed the connection to your Square account.", and the blue "Connect" button was replaced with two different blue buttons, "Reconnect" and "Refresh token".

I then did a test transaction (I have Sandbox setup via the Extension) and it went through!



Mon Jan 15, 2018 9:41 am

Post by spacedvb » Tue Feb 27, 2018 2:41 pm

PHP cURL is not using an updated set of root certificates to verify server certificates.

Around early September 2014, Mozilla removed the trust bits from the certs in their CA bundle that were still using RSA 1024 bit keys. This may lead to TLS libraries having a hard time to verify some sites if the library in question doesn't properly support "path discovery" as per RFC 4158. (That includes OpenSSL and GnuTLS.):

For Plesk 12.5 and higher:

Since 12.5 the URL can be specified in %plesk_dir%\admin\conf\panel.ini file:

By default, curlCertificatesUrl setting is not specified in %plesk_dir%admin\conf\panel.ini.

During an upgrade or the Daily Maintenance task Plesk exports certificates to %plesk_dir%\Additional\PHPSettings\cacert.pem file.

If certificate does not work, try to download certificate from and put it into %plesk_dir%\Additional\PHPSettings directory.

This solution most be apply for Mozilla also



Mon Feb 12, 2018 10:31 am

Post by giantherbs » Tue Apr 30, 2019 2:42 am

Php version 5.4.13 Curl is on and functioning. No errors in the curl test. Most recent version of Opencart, new install. Most recent version of the square extension.
Just a couple of things regarding this post: Initially my webhooks fields did not appear on setup, after trying to figure out why this was happening for a bit, I finally cleared my cache then the fields appeared. Once I was able to enter these, then the extension could connect. Here are some log files for errors that I was getting on setting up:
1) 2019-04-29 16:42:08 - PHP Notice: Undefined index: payment_squareup_sync_source in /var/www/vhosts/ on line 1448
2) 2019-04-29 18:09:07 - PHP Warning: unlink(/var/www/vhosts/ Permission denied in /var/www/vhosts/ on line 94
3) 2019-04-29 18:09:07 - PHP Warning: Invalid argument supplied for foreach() in /var/www/vhosts/ on line 99
4) 2019-04-29 18:12:06 - The Apple Pay domain verification could not finish. The target directory does not exist, or has no write permissions: /var/www/vhosts/

The only current error is the Apple Pay. I post the error logs here for the developers. With the first error, it was having a hard time finding the currency, even though it was enabled. I am unsure what error 2 and 3 are doing. Error 4, throws this alert on the square extension:
"There was an error when trying to sync locations and token: The Apple Pay domain verification could not finish. The target directory does not exist, or has no write permissions: /var/www/vhosts/"

There is also a warning at the top of the page in the square extension that says: "Make sure to enable online payments for your Square account. "

I have not run a test yet to see if the system is actually accepting cards or not. But I thought I would say, prior to refreshing my cache, when I tried to "connect" it would log me completely out, and send me to the opencart login screen. I am assuming it was doing this because, when it does connect - it sends you to the login.

I don't really need Apple Pay as long as the system works, but I did want to post the data for the developers so that they could have data about what might be misfiring.

Thanks for building this!



Fri Apr 26, 2019 11:15 am

Post by franktroy » Sat Aug 31, 2019 7:20 pm

I am just curious if there is a resolution to this issue. I ran into it as well on a new installation and get the following error.

Your Square access token has expired or has been revoked! Click here to re-authorize the Square extension.

When I click the connect button in the Square Extension I get the following.

Notice: Undefined index: access_token in /home/dooverta/public_html/opencart/admin/controller/extension/payment/squareup.php on line 633Warning: Cannot modify header information - headers already sent by (output started at /home/dooverta/public_html/opencart/admin/controller/startup/error.php:34) in /home/dooverta/public_html/opencart/system/library/response.php on line 36

New member


Sun Aug 18, 2019 5:32 pm

Post by cdowner » Sun Nov 17, 2019 10:20 pm

An error was encountered while refreshing the token: The `Authorization` http header of your request was malformed. The header value is expected to be of the format "Bearer TOKEN" (without quotation marks), where TOKEN is to be replaced with your access token (e.g. "Bearer ABC123def456GHI789jkl0"). For more information, see ... nseheaders. If you are seeing this error message while using one of our officially supported SDKs, please report this to

Your Square access token has expired or has been revoked! Click here to re-authorize the Square extension



Sat Feb 03, 2018 1:37 pm
Who is online

Users browsing this forum: No registered users and 8 guests