Quote Originally Posted by Valencia View Post
We have a problem on our end. So Sorry! Please report this error to the Store Owner: SQ-MISSING-TOKEN

I have been trying to find why sometimes a customer gets the error above when trying to make a payment with Webpay. This is what I have found.

I have Square and Paypal as the payment options for my site. When a customer logs into their store account and goes to the OPC screen they have the two payment options with the corresponding radio buttons (neither is selected at this time).

The normal procedure would be to select the payment method (Square Webpay) by selecting the radio button then entering the card details, then Confirm Order. This seems to produce a positive checkout without errors.

However if the customer was to get to the OPC page and enter their card details directly into the Square payment fields, the radio button then becomes highlighted after a couple of digits are entered and the card type is recognized. But when the confirm order button is selected to checkout, the SQ-MISSING-TOKEN error shows up.

It's the same situation if a customer selects Paypal first then stupidly starts entering their card data into the Square fields, Square then becomes highlighted but invariably shows SQ-MISSING-TOKEN error.

So it looks to me if you positively select the radio button for the Square Payments first, then enter card details a checkout without SQ-MISSING-TOKEN error will occur. and you don't get the following error log.

[04-Jul-2022 21:43:05 UTC] PHP Notice: missing token result: check if card button is disabled on dev console using: document.getElementById('card-button'); else look for javascript error in console. in /home/sweetmomentsuk1/public_html/includes/modules/payment/square_webPay.php on line 234.

If this is the case and because we have to think like a customer (not always perfect in the nicest possible way), it might help if the moment the Webpay card fields are selected, the payment option is actually selected at that point along with the radio button.

To me (and I am just a store owner who muddles through) it's a little strange. I am sure the previous standard Square module used to select square the moment you touched the input fields.

Sorry to waffle. Just some thoughts, please take a look if you wish. I have lost a couple of customers recently because of this.

https://www.sweetmomentsuk.co.uk
This only happens with OPC, not the standard checkout. And I have to agree, it's a bit odd that it throws up that error on OPC and not on the standard checkout. The standard checkout takes the payment without errors. If I was a customer with no I.T. knowledge, and could only just understand how to enter my credit card details, once I saw the payment method radio button was highlighted for square web pay when I started entering my card details and without clicking the radio button, I would expect it to process the payment. So the minute I saw the error (you are reporting, and now I am as well), I would walk away and go to the next store that sold similar products because I would feel frustrated and just think that the shopping cart I was trying to buy from had a problem.

This might also explain why my sales have gone down since installing the latest OPC, along with the latest Square Web Pay Module. It is a bug really and it needs fixing somehow. I understand other people on here may say otherwise, but think of it from the customers point of view. They will be stuck there, with a mouse, clicking and clicking and clicking with frustration that they can't pay in their minds. Customers often don't follow instructions well, and just do before they read. Unfortunately, I don't have the knowledge to fix it with OPC, however for the time being, until there is some sort of answer to this problem I will be switching OPC off.

I also see it from the other side, it is frustrating from a developers point of view when something like this is exposed. So I do thank carlwhat for his development on the square web pay module as I know he has put alot of time into this. But it does seem to me that it still doesn't play well with OPC for some reason, despite the time that has gone into developing it. And frustratingly I am not sure what the answer would be to this issue, so I can't help :-(