If this is your first visit, check our documentation. To post, register or login.

Square payment not working

Started by earmsby on 9 Nov 2022, 6:41 PM · Views: 36,770

Results 1 to 13 of 13
9 Nov 2022, 6:41 PM
#1
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #1 by earmsby

new installation of 1.5.7d using the built-in Square module

I am going around in circles trying to get payments working through my Square account. I think several things may be in play so let me outline the steps.

  1. On Monday my live store (v. 1.5.5e) using an old version of the Square plug-in stopped working. The fields for the credit card info would not accept input (as though they were inactive). After some digging around, it seemed that the issue was that Square turned off "SqPaymentForm" as of October 31 which apparently rendered the old square module inoperable. (on that forum topic someone added this link in response to my post about the issue: https://developer.squareup.com/docs/web-payments/migrate#:~:text=%20it%20is%20retired%20on%20october%2031%2C%202022)

  2. In troubleshooting the issue I had with my live store, I could see that the API version my Square app was using was old.

  3. Since I was long overdue anyway, I went ahead and set up a new testing store with zencart v. 1.5.7d (I can't go straight to 1.5.8 yet due to some PHP upgrading that has to be done first).

  4. In my testing with 1.5.7d I configured the built-in Square module to connect to my existing Square app (the one with the outdated API version). Lo and behold, it worked! I was able to place a test order and the payment went through.

  5. This morning, after completing other testing and tweaks in preparation to move to the new 1.5.7d site, the Square payment no longer works. Same symptoms as what I experienced on Monday with the older module.

  6. I started over with Square. Created a new App using the most recent API, did all the same steps of adding the App ID, the secret, adding the redirectURL and so forth. Then I uninstalled and reinstalled the Square module in zc 1.5.7d and did the steps to set up (including access token). Still no luck. The credit card fields are inactive.

I'm kind of at a loss (not to mention unable to receive credit card payment until I get this sorted out). The link that carlwhat posted in my other thread over on the plug-in forum topic seems geared toward developers rather than users of something like the ZC square module. What am I missing?

Thanks for any help!

Ellie Armsby

9 Nov 2022, 6:48 PM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,908
Plugin Contributions:
23

Post #2 by dbltoe

The square mod included with Zen Cart was turned off for good just the other day.

You will need to use the Square WebPay module and install it. With a new install, there's no need to remove or do anything to the old Square files.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

9 Nov 2022, 6:55 PM
#3
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #3 by earmsby

Thank you dbltoe! I have been banging my head on this since Monday. I even checked for a different payment module but the one you linked to didn't come up in the plug-in library for some reason when I searched. I will try that and hopefully be able to take payments again!

Ellie Armsby

11 Nov 2022, 9:20 PM
#4
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,846
Plugin Contributions:
0

Post #4 by barco57

The square API for the old module was scheduled to be turned off on OCT 31st 2022 but for some reason, they left it on until sometime late on November 6th or early on the 7th

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

16 Nov 2022, 12:21 AM
#5
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #5 by earmsby

Thanks for the replies both here and in the old Square plug-in thread. I got the new Square module up and working and am happily taking payments again.

I just discovered a by-product problem of having turned off the old Square module and activated Square Webpay. When I go to look at an order from before the switch, an error is thrown related to square and I can not longer see the details of the order (because they load lower in the page than the payment stuff). Checking the logs, I'm seeing this error:

PHP Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string 
(MODULE_PAYMENT_SQUARE_TOKEN_EXPIRES_AT) at position 0 (M): The timezone could not be found in the 
database in /PATH/TO/MY/store/includes/modules/payment/square.php:526

The instructions for setting up Webpay said to remove the old square mod rather than just turn it off. Should I reinstall it but not activate it?

We do need to occasionally check the order details for older orders, for instance if an item was back-ordered or there was a delivery problem.

Ellie Armsby

16 Nov 2022, 2:36 AM
#6
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,908
Plugin Contributions:
23

Post #6 by dbltoe

earmsby:

I just discovered a by-product problem of having turned off the old Square module and activated Square Webpay. When I go to look at an order from before the switch, an error is thrown related to square and I can not longer see the details of the order (because they load lower in the page than the payment stuff).
https://www.zen-cart.com/showthread.php?228750-Square-WebPay-support-thread&p=1388730#post1388730

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

16 Nov 2022, 1:32 PM
#7
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #7 by earmsby

Thank you dbltoe, that solved the issue!

Ellie Armsby

17 Nov 2022, 6:12 PM
#8
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #8 by earmsby

Now I have discovered another issue with having switched over to the Square WebPay module:

I've just added a coupon for the holidays and fine that if a user goes through the checkout process without a coupon, there is no problem. However when they add the coupon at the Payment Info screen, there is a red, scary message that says:

"We have a problem on our end. So Sorry! Please report this error to the Store Owner: SQ-MISSING-TOKEN"

They can still proceed to the confirmation and if they go back to previous screens the error message does not appear again. It seems to be only at the point at which they enter the code that the error occurs.

I did do some searching the forum for this and found a few posts but they seemed to refer to carts with more than one payment option. I only have Square webpay.

I was just about to do marketing of my coupon code but need to hold off until I solve this so that I'm not driving customers to the shop only to have them scared off by the message.

Ellie Armsby

17 Nov 2022, 6:34 PM
#9
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #9 by earmsby

earmsby:

Now I have discovered another issue with having switched over to the Square WebPay module:

I've just added a coupon for the holidays and fine that if a user goes through the checkout process without a coupon, there is no problem. However when they add the coupon at the Payment Info screen, there is a red, scary message that says:

"We have a problem on our end. So Sorry! Please report this error to the Store Owner: SQ-MISSING-TOKEN"

They can still proceed to the confirmation and if they go back to previous screens the error message does not appear again. It seems to be only at the point at which they enter the code that the error occurs.

I did do some searching the forum for this and found a few posts but they seemed to refer to carts with more than one payment option. I only have Square webpay.

I was just about to do marketing of my coupon code but need to hold off until I solve this so that I'm not driving customers to the shop only to have them scared off by the message.

A bit more testing of this behavior revealed that if the customer enters their card info into the Square Webpay form first and THEN enters the coupon code, the error message does not appear. Since the coupon code form appears above the card info form, I think many customers with a coupon will enter that first.

Maybe I should be posting this over on the forum for this plug-in?

Ellie Armsby

17 Nov 2022, 6:35 PM
#10
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Post #10 by carlwhat

i would suggest you look a little harder.

i would also suggest, as a web designer, that you get a little better with css.

https://tinyurl.com/2ez9u4p2

i would also suggest that if you want to drive traffic to your site, you do not include multiple links which result in either a 404 or site not found:

http://www.armsbyservices.com/portfolio_ecommerce.php

finally, i would suggest more gratitude to the people that actually code the solutions that you sell and/or use.

but hey that is just my opinion.

good luck.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

17 Nov 2022, 7:08 PM
#11
earmsby avatar

earmsby

Zen Follower

Join Date:
Oct 2006
Location:
Worcester, MA
Posts:
451
Plugin Contributions:
0

Post #11 by earmsby

Thank you @carlwhat for your reply and for pointing out problems with an old, no longer used website of mine. I will update my ZenCart forum profile and remove that URL from my signature.

I certainly did not mean to disrespect you or any of the wonderful folks who are building zencart. I have been a user of ZenCart since 2006 and have advocated for it among colleagues since then. I am very grateful for your work in creating this new Square payment module. I am using it successfully and appreciated the couple of pointers that I needed in order to get it working for my shop (https://store.hildegard.com).

I did read through the thread on another forum that pertained to this issue but it seemed like that discussion had to do with the use of something called OPC. I don't use that and I don't even know what it stands for. Since it doesn't look like there was a resolution to that issue from July, 2022 and since the back and forth did not seem to apply to me, I will simply add some custom text to my payment page to advise customers to 1) enter their card info before a coupon code and 2) ignore any error message they see as a result of entering a coupon code.

Thank you for all that you have done for ZenCart and I'm sorry that you took offense to my question.

Ellie Armsby

17 Nov 2022, 8:10 PM
#12
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,761
Plugin Contributions:
56

Post #12 by swguy

... had to do with the use of something called OPC. I don't use that and I don't even know what it stands for.
One Page Checkout. It's a plugin that consolidates the three pages of checkout in a standard install.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

17 Nov 2022, 9:26 PM
#13
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Post #13 by carlwhat

i accept your apology.

i have never been a hug fan of the way coupons work on zen-cart. i have worked on them in the past; both in the core repository as well as on various client sites.

i think the problem you are pointed out can be seen here:

https://www.dropbox.com/s/5qnyafrk2cbg30p/prior_to_change_coupon.webm?dl=0

which, i am in agreement is a bit misleading. customers want to put in a coupon code, and then ensure the coupon is taken prior to giving up their credit card data. that makes sense to me.

if you find the following method, which in version v1.0.3 is on line 257, you can change the code as follows:

//from
    public function pre_confirmation_check()
        {
            global $messageStack;
            if (empty($_REQUEST['tokenResult'])) {
                trigger_error('missing token result: ' . " check if card button is disabled on dev console using: document.getElementById('card-button'); else look for javascript error in console.");
                $messageStack->add_session('checkout_payment', MODULE_PAYMENT_SQ_WEBPAY_TEXT_MISCONFIGURATION, 'error');
                zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
            }
//to
    public function pre_confirmation_check()
        {
            global $messageStack;
            if (empty($_REQUEST['tokenResult'])) {
                if (empty($messageStack->messages)) {
                    trigger_error('missing token result: ' . " check if card button is disabled on dev console using: document.getElementById('card-button'); else look for javascript error in console.");
                    $messageStack->add_session('checkout_payment', MODULE_PAYMENT_SQ_WEBPAY_TEXT_MISCONFIGURATION, 'error');
                }
                zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
            }

i think your problem will go away. assuming i have it correct. you can see the results of my testing here:

https://www.dropbox.com/s/l02ri0fp6x4mbul/after_coupon_change.webm?dl=0

note that i have only included about half of the pre_confirmation check function. the rest of the function remains the same and is required.

hope that helps.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.