Post by NewJovi » Mon Jun 27, 2022 6:05 pm

OpenCart 3.0.3.8
Square 3.3.4
Square API Version: 2020-11-18

Hi, I’m very new to this but as I have a bit of time, I’ve decided to try and develop this myself so that I can learn as I go along. I’ve installed OpenCart version 3.0.3.8 on my web hosting (unfortunately, my hosting does not yet support PHP 8, so I can’t have version 4 and I can’t move hosting easily just yet).
I’m struggling to set up the Square payments, as I keep receiving an error message when I try to connect OpenCart to Square, which seems to be related to the Apple Pay domain verification. Here’s the error message:

There was an error when trying to sync locations and token: Invalid domain `shop.newjovi.com`: expected GET https://shop.newjovi.com/.well-known/ap ... ssociation to return 9122 bytes but instead returned 9126.squareup_error_field

I have placed the file here: https://shop.newjovi.com/.well-known/ap ... ssociation, which I have downloaded from the Square dashboard. However, whenever I go to connect my site, I see the above error.

When I upload the file, it is indeed 9122 bytes, but it grows to 9126 bytes whenever I try to connect. At first I thought it was a DNS issue with my subdomain, but having resolved that, I’m still having problems. I have also left out the section about "web hooks" as I was under the impression this was optional.

Please can anyone advise what it is I'm doing wrong? I hope I've given enough information, but if not, please let me know what you need!

Many thanks,

Gary
Last edited by NewJovi on Wed Jun 29, 2022 2:46 pm, edited 1 time in total.

Newbie

Posts

Joined
Mon Jun 27, 2022 2:56 am

Post by halfhope » Mon Jun 27, 2022 11:13 pm

Hi!

I did not read the message to the end, so I can be mistaken and take you in the wrong direction. I think it's a UTF-8 with/without BOM encoding.
Remove BOM using PHP:

Code: Select all

function remove_utf8_bom($text) {
    $bom = pack('H*','EFBBBF');
    $text = preg_replace("/^$bom/", '', $text);
    return $text;
}
Remove BOM using terminal:

Code: Select all

sed -i "1s/^\xEF\xBB\xBF//" content.txt

My extensions in marketplace. [ security | flexibility | speedup ]


User avatar
Active Member

Posts

Joined
Tue Dec 10, 2013 9:44 pm
Location - San Diego

Post by NewJovi » Tue Jun 28, 2022 4:22 am

Thanks, but unfortunately that doesn't seem to be the case. When I open the file in Notepad++, it shows that it's just UTF-8. I have also downloaded the file back from my hosting after it changes from 9122B to 9126B and it's still UTF-8, not UTF-8 BOM.

Or am I missing the point?

I should also mention that I've now configured the Webhooks bit. I followed this video and can confirm I've done everything it says: https://www.youtube.com/watch?v=4sSSKwA3KrM.

Thanks,

Gary

Newbie

Posts

Joined
Mon Jun 27, 2022 2:56 am

Post by straightlight » Tue Jun 28, 2022 5:50 am

NewJovi wrote:
Tue Jun 28, 2022 4:22 am
Thanks, but unfortunately that doesn't seem to be the case. When I open the file in Notepad++, it shows that it's just UTF-8. I have also downloaded the file back from my hosting after it changes from 9122B to 9126B and it's still UTF-8, not UTF-8 BOM.

Or am I missing the point?

I should also mention that I've now configured the Webhooks bit. I followed this video and can confirm I've done everything it says: https://www.youtube.com/watch?v=4sSSKwA3KrM.

Thanks,

Gary
In your Notepad++ , ensure your encoding setting is set to: UTF-8 without BOM. Then, save the file. Re-upload the file to your file server (FTP).

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by NewJovi » Tue Jun 28, 2022 6:59 am

Thanks. Have done this, but it's not done the trick. In fact, when I re-saved the file as UTF-8, it was suddenly 9126 bytes. Not only that, but if I DELETE the file from my .well-known folder and then click "Reconnect", I get the exact same error and the 9126 byte file is regenerated. I'm really confused by this. Will it prevent me from taking card payments, or just Apple Pay?

Newbie

Posts

Joined
Mon Jun 27, 2022 2:56 am

Post by dgpruk » Wed Jun 29, 2022 12:02 am

All the sites I am using Square on are giving the same error. Payments still come in but I believe Apple Pay is not working. I think this is a square issue as nothing has changed on any of my sites. Best log it with iSenseLabs.

Newbie

Posts

Joined
Mon Apr 03, 2017 12:30 am

Post by NewJovi » Wed Jun 29, 2022 5:37 am

Thank you! Yes, I actually ended up running through a test purchase using my credit card and it worked, so yes, it's literally just Apple Pay as you say. Thanks for confirming that! :)

I noticed a couple of other issues:
  • I got an error message to the effect that my credit card was maxed out. After a small heart attack, I checked my balance and it wasn't! I meant to take note of the error, but it was something like "MAXIMUM_TRANSACTIONS". However, my banking app came up asking me to verify the payment was me (something I have set up for every online payment) and it went through.
  • Once payment had gone through, it didn't redirect me to a "Thank you for your order" page. The card details form (guest checkout) remained on screen and all the details were still filled in. I could easily have clicked and paid again! This is probably more of an issue to raise with OpenCart, but I thought I'd check!
However, the order came through perfectly. Everything was simple to use and I was pleased with the interface. I am confident that when orders start coming through, that side of things will be easy. I was able to refund myself easily enough, too.

Thanks,

Gary

Newbie

Posts

Joined
Mon Jun 27, 2022 2:56 am

Post by halfhope » Wed Jun 29, 2022 5:42 am

Hi!

Gary, glad it worked out for you. Right now, the forum doesn't have a dedicated button. So please, change the title of the topic, add at the beginning of the title [SOLVED].

Bad EN)

My extensions in marketplace. [ security | flexibility | speedup ]


User avatar
Active Member

Posts

Joined
Tue Dec 10, 2013 9:44 pm
Location - San Diego

Post by dgpruk » Wed Jun 29, 2022 3:28 pm

halfhope wrote:
Wed Jun 29, 2022 5:42 am
Hi!

Gary, glad it worked out for you. Right now, the forum doesn't have a dedicated button. So please, change the title of the topic, add at the beginning of the title [SOLVED].

Bad EN)
This issue is NOT resolved, the error is still there and apple pay still doesn't work.

Also, the issue Gary states with the payment page not going to successful checkout page is correct as it explains why we have seen a good few duplicate orders as some customers are indeed clicking to pay again and paying twice within minutes.

These could be due to the same issue with either the Opencart square extension or square themselves. I'm not convinced its an issue with Opencart itself just the extension or a change square made.

I posted a comment on the isenselabs.com square extension page for them to look into it further.

Newbie

Posts

Joined
Mon Apr 03, 2017 12:30 am

Post by RebelGrandSon » Tue Jul 12, 2022 12:41 am

Hello, I was looking for an answer to this question last night and came across this thread and i actually ended up fixing it on my own and I would like to share how I did so, to get apple pay to work and to get the error go away. Keep in mind this solution may not work for everyone

The issue when I was getting this error was when I was trying to connect opencart and square my domain was not verified by square on the apple pay tab

Image

Where it says verified in my screenshot, it was saying pending before. You have to upload the file square gives you to your web server where it tells you too, then click verify and then your domain will say verified. From there you can reconnect and it should go through!

User avatar
Newbie

Posts

Joined
Tue Jul 12, 2022 12:32 am


Post by Lafush » Thu Mar 23, 2023 5:33 am

My issue now after i verified my domain through square site, is that i get this error:
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/sites/xxx/.well-known
I tried changing the folder permission settings using Filezilla but that didn't fix it.

Newbie

Posts

Joined
Wed Aug 12, 2015 6:19 am
Who is online

Users browsing this forum: No registered users and 131 guests