Zen Cart Logo
Forums / Addon Payment Modules / Square WebPay support thread.

Square WebPay support thread.

Views: 128,132

Results 421 to 440 of 800
10 Apr 2023, 20:44
#421
carlwhat avatar

carlwhat

zennedOut

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

Square WebPay support thread.

brittainmark:

zen cart 1.5.8
square web pay 1.0.4
bootstrap 3.5.2

I have an issue where the terms and conditions do not need to be ticked for an order to go through. I think it is connected to JavaScript and using preventDefault method. I believe that this means that required fields are not checked when the form is submitted. I have resolved the issue by adding the following to includes/modules/pages/checkout_payment/jscript_square_webPay.php

original starting line 157

                var verifyBuyerResult = document.createElement("input");
                verifyBuyerResult.setAttribute("type", "hidden");
                verifyBuyerResult.setAttribute("name", "verifyBuyerResult");
                verifyBuyerResult.setAttribute("value", JSON.stringify(verificationToken));
                document.querySelector('[name="checkout_payment"]').appendChild(verifyBuyerResult);
                cardButton.disabled = false;                 
                document.forms["checkout_payment"].submit();
> new
> ```
                    var verifyBuyerResult = document.createElement("input");
                    verifyBuyerResult.setAttribute("type", "hidden");
                    verifyBuyerResult.setAttribute("name", "verifyBuyerResult");
                    verifyBuyerResult.setAttribute("value", JSON.stringify(verificationToken));
                    document.querySelector('[name="checkout_payment"]').appendChild(verifyBuyerResult);
                    cardButton.disabled = false;                 
[B]                    let isFormValid = document.forms["checkout_payment"].checkValidity();
                    if (isFormValid) {[/B]
                        document.forms["checkout_payment"].submit();
[B]                    } else {
                        document.forms["checkout_payment"].reportValidity();
                    }[/B]

Something similar may be required for one page checkout!

this makes sense.

good catch.

best,

01 May 2023, 03:57
#422
brian70809 avatar

brian70809

New Zenner

Join Date:
Jun 2011
Posts:
85
Plugin Contributions:
0

Re: Square WebPay support thread.

Hello all,

Zen Cart 1.5.8
Using Bootstrap 3.5.3

I am able to verify or accept transactions by going to square.. but I am no longer able to do it through the DETAILS option of an order..

I'm getting this error:

"The configuration of the order's payment module (square_webPay) has changed. No refunds, auths, captures or voids can be done for this order."

My module is Green...

Thanks for any help!

01 May 2023, 13:39
#423
carlwhat avatar

carlwhat

zennedOut

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

Re: Square WebPay support thread.

brian70809:

Hello all,

Zen Cart 1.5.8
Using Bootstrap 3.5.3

I am able to verify or accept transactions by going to square.. but I am no longer able to do it through the DETAILS option of an order..

I'm getting this error:

"The configuration of the order's payment module (square_webPay) has changed. No refunds, auths, captures or voids can be done for this order."

My module is Green...

Thanks for any help!

i think you have a token issue.

are you sure you can accept new orders using square webPay?

you are saying you can not do refunds or voids or captures from the admin side. and it looks like the problem is due to an invalid token.

review documentation and this thread for configuring the handler, and ensure that you have a valid token.

best.

21 May 2023, 08:19
#424
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Square WebPay support thread.

Hello,
Using ZenCart 1.5.6c, MariaDB 10.3.24, PHP 7.3.15 (I do have an upgrade plan to PHP 8.2.x and ZenCart 1.5.8a in the next 3 months)
I've tried to use Square Web Payments and the 1st page of checkout looks good, I am able to enter credit card details, 2nd page passes, and when going to the 3rd page I get a "An error has occured, please refresh the page" error. When I refresh the page, I go back to page 1 of checkout (where I can enter credit card details), with a "nonce already used for a transaction, please obtain a new nonce".

The error log for the initial "an error has occurred" shows this:

#8  require(/<edited>/Public/html/shop/includes/modules/pages/checkout_process/header_php.php) called at [/<edited>/Public/html/shop/index.php:36]
--> PHP Fatal error: 1364:Field 'transaction_id' doesn't have a default value :: INSERT INTO square_payments (order_id, location_id, payment_id, sq_order, created_at) VALUES ('171', 'Q5...<edited>...MS9', '7BCuB7lE1...<edited>...0hd9HZY', 'yeyuuRe...<edited>...tBdQJZY', now()) ==> (as called by) /<edited>/Public/html/shop/includes/functions/functions_general.php on line 952 <== in /<edited>/Public/html/shop/includes/classes/db/mysql/query_factory.php on line 171.

Do I need to edit the Square code to have some default value for the transaction ID?

21 May 2023, 13:02
#425
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Square WebPay support thread.

gernot:

Hello,
Using ZenCart 1.5.6c, MariaDB 10.3.24, PHP 7.3.15 (I do have an upgrade plan to PHP 8.2.x and ZenCart 1.5.8a in the next 3 months)
I've tried to use Square Web Payments and the 1st page of checkout looks good, I am able to enter credit card details, 2nd page passes, and when going to the 3rd page I get a "An error has occured, please refresh the page" error. When I refresh the page, I go back to page 1 of checkout (where I can enter credit card details), with a "nonce already used for a transaction, please obtain a new nonce".

The error log for the initial "an error has occurred" shows this:

#8 require(/<edited>/Public/html/shop/includes/modules/pages/checkout_process/header_php.php) called at [/<edited>/Public/html/shop/index.php:36]
--> PHP Fatal error: 1364:Field 'transaction_id' doesn't have a default value :: INSERT INTO square_payments (order_id, location_id, payment_id, sq_order, created_at) VALUES ('171', 'Q5...<edited>...MS9', '7BCuB7lE1...<edited>...0hd9HZY', 'yeyuuRe...<edited>...tBdQJZY', now()) ==> (as called by) /<edited>/Public/html/shop/includes/functions/functions_general.php on line 952 <== in /<edited>/Public/html/shop/includes/classes/db/mysql/query_factory.php on line 171.

> Do I need to edit the Square code to have some default value for the transaction ID?
There should have been more to that log than just the final "who did it" that includes the who-called-who-at-what line information.  From what you've posted, all I can decipher is that someone called a function in functions_general.php during the checkout_process step.

I'm not sure how much I can help (@carlwhat is on vacation for the next couple of weeks), but I'll try my best if I have sufficient data to muddle my way through!
21 May 2023, 13:16
#426
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Square WebPay support thread.

My apologies, I mistakenly thought I should par the log down to the last part. Here the full entry:

[21-May-2023 15:29:33 Asia/Tokyo] Request URI: /shop/index.php?main_page=checkout_process, IP address: 192.168.1.3
#1  trigger_error() called at [/home/hase/Public/html/shop/includes/classes/db/mysql/query_factory.php:171]
#2  queryFactory->show_error() called at [/home/hase/Public/html/shop/includes/classes/db/mysql/query_factory.php:143]
#3  queryFactory->set_error() called at [/home/hase/Public/html/shop/includes/classes/db/mysql/query_factory.php:270]
#4  queryFactory->Execute() called at [/home/hase/Public/html/shop/includes/functions/functions_general.php:952]
#5  zen_db_perform() called at [/home/hase/Public/html/shop/includes/modules/payment/square_webPay.php:512]
#6  square_webPay->after_process() called at [/home/hase/Public/html/shop/includes/classes/payment.php:254]
#7  payment->after_process() called at [/home/hase/Public/html/shop/includes/modules/pages/checkout_process/header_php.php:17]
#8  require(/home/hase/Public/html/shop/includes/modules/pages/checkout_process/header_php.php) called at [/home/hase/Public/html/shop/index.php:36]
--> PHP Fatal error: 1364:Field 'transaction_id' doesn't have a default value :: INSERT INTO square_payments (order_id, location_id, payment_id, sq_order, created_at) VALUES ('171', 'Q5F86K1K1WMS9', '7BCuB7lE1Gz7rsvNayHoyV0hd9HZY', 'yeyuuReM6B3qnxe42yZCTrtBdQJZY', now()) ==> (as called by) /home/hase/Public/html/shop/includes/functions/functions_general.php on line 952 <== in /home/hase/Public/html/shop/includes/classes/db/mysql/query_factory.php on line 171.
21 May 2023, 13:24
#427
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Square WebPay support thread.

Thanks, @gernot. It'll take me a while (as always), since I don't have any clients who use that payment method, to be able to review the payment method's handling and see why (in this case) the transaction_id was missing.

What version of Square WebPay are you using?

21 May 2023, 14:44
#428
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Square WebPay support thread.

Hello @lat9,
Thank you very much. I am using v1.0.4 (the current latest). For the (non-Web) Square module I have v1.5 installed, but it is disabled.
I will try to see what I can do on my own, I'm just not sure if the "default transaction ID" is something that should be available and is not being picked up, or whether it is something that needs to be created from inside the plugin.

21 May 2023, 17:13
#429
carlwhat avatar

carlwhat

zennedOut

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

Re: Square WebPay support thread.

gernot:

Hello @lat9,
Thank you very much. I am using v1.0.4 (the current latest). For the (non-Web) Square module I have v1.5 installed, but it is disabled.
I will try to see what I can do on my own, I'm just not sure if the "default transaction ID" is something that should be available and is not being picked up, or whether it is something that needs to be created from inside the plugin.

omg! there is documentation in the code! who knew:

        /**
         * Check and fix table structure if appropriate
         *
         * Note: The tender_id and transaction_id fields are no longer populated; but are left behind in older installs for lookup of history
         */

the error that you are no receiving is due to the version of mysql you are running. you need to alter the table to allow null for transaction_id. see here:

https://stackoverflow.com/questions/212939/how-do-i-modify-a-mysql-column-to-allow-null

you can go into phpmyadmin or use mysql via the command line and need to run a command like:

ALTER TABLE square_payments MODIFY transaction_id  null;

or something like that.

best.

21 May 2023, 17:26
#430
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Square WebPay support thread.

gernot:

Hello @lat9,
Thank you very much. I am using v1.0.4 (the current latest). For the (non-Web) Square module I have v1.5 installed, but it is disabled.
I will try to see what I can do on my own, I'm just not sure if the "default transaction ID" is something that should be available and is not being picked up, or whether it is something that needs to be created from inside the plugin.
It would help to see if there are additional PHP Notices being logged at the time of the error. Since you're running zc156c, you can install Report All Errors (https://www.zen-cart.com/downloads.php?do=file&id=1792) and set the storefront setting to IgnoreDups.

P.S. Thanks, @carlwhat, your post came in while I was distracted in my response!

21 May 2023, 23:50
#431
gernot avatar

gernot

Zen Follower

Join Date:
Feb 2017
Location:
Tokyo, Japan
Posts:
334
Plugin Contributions:
0

Re: Square WebPay support thread.

Hello @carlwhat
Many thanks! I could change the table to accept Null as a valid value with

ALTER TABLE square_payments MODIFY transaction_id varchar(255);

since varchar(255) by default accepts NULL.

Hello @lat9
Thank you for the recommendation, I will test further and attempt to install this plugin for better debugging.

26 May 2023, 17:50
#432
jwlamb avatar

jwlamb

Zen Follower

Join Date:
Jan 2014
Location:
Arizona
Posts:
110
Plugin Contributions:
0

Re: Square WebPay support thread.

When I have this module uploaded to my server it doesn't give me the square_webPay option on the payment module. It then also blocks any of the payment modules to have the side menu open on the page. If I delete or rename the /includes/modules/payment/square_webPay.php file then the other payment modules allow the menus to open. I can't install this module if I can't get the menus to open. I did have the old square payment module installed and it stopped working (can't click on text boxes during checkout). I clicked on remove module so the icon is red now, but I can't get the square_webPay to load. (zencart v1.5.7b, php 5.6)

26 May 2023, 18:36
#433
swguy avatar

swguy

Administrator

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

Re: Square WebPay support thread.

Perhaps there's a log file in the /logs folder that would help us understand what's happening?

26 May 2023, 19:16
#434
jwlamb avatar

jwlamb

Zen Follower

Join Date:
Jan 2014
Location:
Arizona
Posts:
110
Plugin Contributions:
0

Re: Square WebPay support thread.

swguy:

Perhaps there's a log file in the /logs folder that would help us understand what's happening?

unfortunately not

27 May 2023, 03:25
#435
carlwhat avatar

carlwhat

zennedOut

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

Re: Square WebPay support thread.

jwlamb:

unfortunately not

according to the very thorough documentation this module requires php 7.4 although it has been tested and worked with php 7.3. see:

https://www.zen-cart.com/downloads.php?do=file&id=2345

php 5.6 is not supported nor will it work.

best.

31 May 2023, 19:26
#436
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Square WebPay support thread.

I'd like to reduce the empty vertical space below the credit card info entry box and above the next payment method on the checkout_payment page. Using browser web developer tools, I see there is a hidden button with id="card-button" with text "Use Credit Card" that takes up 21.5 px vertically. When I use the Square payment method, I never see this button. Under what conditions does this button become visible and can the vertical space taken up by the button be eliminated when hidden? Can anyone suggest an approach to reduce this empty space?
Thank you!
zc157c, php8.0.2, Square WebPay 1.0.2

31 May 2023, 21:55
#437
dbltoe avatar

dbltoe

Totally Zenned

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

Re: Square WebPay support thread.

Are you using the standard three-page checkout or something like OPC?

01 Jun 2023, 00:00
#438
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Square WebPay support thread.

I'm using the standard 3-page checkout and standard non-responsive template. Updated to 1.0.4 with no change to appearance.
Dave

01 Jun 2023, 15:36
#439
dbltoe avatar

dbltoe

Totally Zenned

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

Re: Square WebPay support thread.

Care to give us a look? Use yoursiteDOTcom if you are not ready for the world to see it.

01 Jun 2023, 16:06
#440
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Square WebPay support thread.

Sure. "store.febt DOT org".
Dave