Post by grozzy » Thu Dec 12, 2019 10:51 pm

I'm on OpenCart Version 3.0.3.2 and am trying to get my Square Payments extension setup and connected. When I try to connect I'm getting the following error:

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 https://docs.connect.squareup.com/api/c ... nseheaders. If you are seeing this error message while using one of our officially supported SDKs, please report this to developers@squareup.com.

If I leave the extension setup and come back in, this is a persistent error message:

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

I installed OpenCart using Softaculous and I'm on shared hosting. I've verified with my hosting provider that cURL is enabled and there is no firewall issue blocking the connection. Emails to develoeprs@squareup.com have gone unanswered twice now. Any help would be much appreciated. Thank you!

Newbie

Posts

Joined
Tue Apr 24, 2018 11:02 pm

Post by thekrotek » Fri Dec 13, 2019 6:17 pm

But error message already tells you everything: token has expired, renew it.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by grozzy » Sat Dec 14, 2019 5:51 am

I don't really know how to do that. I've tried everything I can think of and can't get this to work. I found this in the forums and ran the script on my site:

<?php
$url = 'https://connect.squareup.com/oauth2/token';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
$error_number = curl_errno($curl);
$error_text = curl_error($curl);
$curl_info = curl_getinfo($curl);
curl_close($curl);

echo '<h1>DATA:</h1>';
echo '<pre>' . htmlentities($data) . '</pre>';
echo '<h1>ERROR (' . $error_number . '):</h1>';
echo '<pre>' . $error_text . '</pre>';
echo '<h1>INFO:</h1>';
echo '<pre>'; print_r($curl_info); echo '</pre>';
?>

This was the response, which seems normal:

DATA:
{
"message": "NotFound",
"type": "not_found"
}
ERROR (0):
INFO:
Array
(
[url] => https://connect.squareup.com/oauth2/token
[content_type] => application/json
[http_code] => 404
[header_size] => 553
[request_size] => 69
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.219417
[namelookup_time] => 0.000563
[connect_time] => 0.050322
[pretransfer_time] => 0.163336
[size_upload] => 0
[size_download] => 51
[speed_download] => 232
[speed_upload] => 0
[download_content_length] => 51
[upload_content_length] => -1
[starttransfer_time] => 0.219345
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 74.122.190.68
[certinfo] => Array
(
)

[primary_port] => 443
[local_ip] => 50.31.162.218
[local_port] => 43296
)

Newbie

Posts

Joined
Tue Apr 24, 2018 11:02 pm

Post by straightlight » Sat Dec 14, 2019 7:42 am

This was the response, which seems normal:

DATA:
{
"message": "NotFound",
"type": "not_found"

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: Baidu [Spider] and 8 guests