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

Square WebPay support thread.

Views: 128,190

Results 281 to 300 of 800
15 Oct 2022, 12:50 AM
#281
todoonada avatar

todoonada

Zen Follower

Join Date:
Nov 2006
Posts:
127
Plugin Contributions:
0

Square WebPay support thread.

carlwhat:

i have an already installed version of square web pay on my development server. if i switch my dev box to run php 8.0.20, i am able to process orders without problem. according to the square docs, the api version i used is good up to square 8.0.

if i click remove and remove the square webPay module, zc removes the module no problem. and it still shows up. i am then able to re-install it.

again, my dev machine is running v157 (latest codebase) and php 8.0.20.

your error above suggests a missing class file. specifically:

includes/modules/payment/square_webPay/square/square/src/Environment.php.

in fact, if i remove that file from my system, i receive the following error:

[14-Oct-2022 17:14:41 America/Los_Angeles] PHP Fatal error: Uncaught Error: Class "Square\Environment" not found in /var/www/zcdev/includes/modules/payment/square_webPay.php:107
Stack trace:
#0 /var/www/zcdev/admin/modules.php(204): square_webPay->__construct()
#1 /var/www/zcdev/admin/index.php(11): require('...')
#2 {main}
thrown in /var/www/zcdev/includes/modules/payment/square_webPay.php on line 107

[14-Oct-2022 17:14:41 America/Los_Angeles] Request URI: /admin/index.php?cmd=modules&set=payment, IP address: 192.168.14.74
--> PHP Fatal error: Uncaught Error: Class "Square\Environment" not found in /var/www/zcdev/includes/modules/payment/square_webPay.php:107
Stack trace:
#0 /var/www/zcdev/admin/modules.php(204): square_webPay->__construct()
#1 /var/www/zcdev/admin/index.php(11): require('...')
#2 {main}
thrown in /var/www/zcdev/includes/modules/payment/square_webPay.php on line 107.

> 
> looks pretty similar to your error.   in fact, i would say the same.
> 
> i am happy that you got it working.  but for anyone reading this thread, this module has been tested on php 8.0 and this module works without issue on that version of php.
> 
> best.

Thank you.
includes/modules/payment/square_webPay/square/square/src/Environment.php is there, size is 236B. 
I also tested on my local testing Apache with PHP 8.0.15. Same error:

PHP Fatal error: Uncaught Error: Class "Square\Environment" not found in /home/tim/zencartNewSisa/zencart1.5.6/includes/modules/payment/square_webPay.php:105


The module does not show up and the box on the right side of the payment modules list is missing.

PS: I do not have anything running yet. I just uploaded the files and checked if I can see the module.

PPS: I also checked with PHP 8.1. Get the same error.
15 Oct 2022, 12:38 PM
#282
swguy avatar

swguy

Administrator

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

Re: Square WebPay support thread.

includes/modules/payment/square_webPay.php line 846 creates the error log:

[15-Oct-2022 12:28:29 UTC] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Square\Models\Order::__construct(), 0 passed in /home/cust/public_html/shop/includes/modules/payment/square_webPay.php on line 846 and exactly 1 expected in /home/cust/public_html/shop/includes/modules/payment/square_webPay/square/square/src/Models/Order.php:172

Perhaps instead of

return new Models\Order;

it should be

return null;

(This can happen in abnormal situations where the creation of all parts of the error didn't complete successfully.)

15 Oct 2022, 8:03 PM
#283
bfmarini avatar

bfmarini

New Zenner

Join Date:
May 2008
Posts:
29
Plugin Contributions:
0

Re: Square WebPay support thread.

We installed this mod yesterday and had everything working and weren't experiencing any issues. Today we are seeing a lot of slowness / delay with the credit card fields populating and often times, the complete component doesn't load with the zip code field missing. I've linked some screenshots … just curious if anyone has run into this or has any ideas?

Image of credit card input after some delay - https://drive.google.com/file/d/16EUndH_xER8bQbWRDcAwwk6mmIkmNkcL/view?usp=sharing

Image of screen while it loads .. almost takes 10 seconds or more sometimes - https://drive.google.com/file/d/1DuD_BGkTOWB9K42wvW9q4u17iK3Xmpxf/view?usp=sharing

17 Oct 2022, 1:39 AM
#284
todoonada avatar

todoonada

Zen Follower

Join Date:
Nov 2006
Posts:
127
Plugin Contributions:
0

Re: Square WebPay support thread.

Hello carlwhat,
about thePHP Fatal error: Uncaught Error: Class "Square\Environment" not found in /home/tim/zencartNewSisa/zencart1.5.7/includes/modules/payment/square_webPay.php:105
error:
When I uploaded the files for WebPay, I was already on PHP 8.0. I switched the version of PHP several times (8.0 to 7.4 and back and forth). Then I saw that the error message changed while on PHP 8.0. It was
Use of undefined constant MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE - assumed 'MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE'
now. The WebPay module still did not show up in the payment modules.
I then applied the code you gave here https://www.zen-cart.com/showthread.php?228750-Square-WebPay-support-thread&p=1388847#post1388847
and the module showed up under PHP 8.0.

I got exactly the same files/code running on my local server. On my local server I run PHP 8 and I can not change between PHP 8 and 7. The module still is not showing up on my local server. No files missing. Same files like on my live server.

Now it looks like uploading the files under PHP 8 caused the problem. Uploading the files under PHP 7 and the upgrading to PHP 8 worked (after applying your changed code).

17 Oct 2022, 3:35 AM
#285
carlwhat avatar

carlwhat

zennedOut

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

Re: Square WebPay support thread.

todoonada:

Hello carlwhat,
about thePHP Fatal error: Uncaught Error: Class "Square\Environment" not found in /home/tim/zencartNewSisa/zencart1.5.7/includes/modules/payment/square_webPay.php:105
error:
When I uploaded the files for WebPay, I was already on PHP 8.0. I switched the version of PHP several times (8.0 to 7.4 and back and forth). Then I saw that the error message changed while on PHP 8.0. It was
Use of undefined constant MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE - assumed 'MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE'
now. The WebPay module still did not show up in the payment modules.
I then applied the code you gave here https://www.zen-cart.com/showthread.php?228750-Square-WebPay-support-thread&p=1388847#post1388847
and the module showed up under PHP 8.0.

I got exactly the same files/code running on my local server. On my local server I run PHP 8 and I can not change between PHP 8 and 7. The module still is not showing up on my local server. No files missing. Same files like on my live server.

Now it looks like uploading the files under PHP 8 caused the problem. Uploading the files under PHP 7 and the upgrading to PHP 8 worked (after applying your changed code).

  • glad you got it figured out.
  • you seem like a smart guy. i know you can figure out other things associated with the module and any problems you may encounter.
  • my apologies that i have not uploaded a new version of this software. i do have those changes in my latest version. i just have a number of other things on my plate that need to get done prior to doing any updates.
  • please note that the current version will NOT work with php 8.2.
  • it will also NOT work with php 8.1.

best.

17 Oct 2022, 2:40 PM
#286
pazdar avatar

pazdar

Zen Follower

Join Date:
Jan 2008
Posts:
174
Plugin Contributions:
0

Re: Square WebPay support thread.

Thank you, I'm running 1.0.1 according to module on my admin site. I was missing apimoto file which I could swear I had loaded previously. I reloaded that file, ran a dummy order and it appears to have worked.

17 Oct 2022, 2:48 PM
#287
carlwhat avatar

carlwhat

zennedOut

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

Re: Square WebPay support thread.

pazdar:

Thank you, I'm running 1.0.1 according to module on my admin site. I was missing apimoto file which I could swear I had loaded previously. I reloaded that file, ran a dummy order and it appears to have worked.

:thumbsup:

20 Oct 2022, 12:13 AM
#288
todoonada avatar

todoonada

Zen Follower

Join Date:
Nov 2006
Posts:
127
Plugin Contributions:
0

Re: Square WebPay support thread.

I have a question about the language displayed. I translated the file square_webPay.php, but in the shop it still displays English in the input fields for "Card Number" and "MM/YY". I would like to translate those and the hints below ("Enter card number", etc), but do not know where I can do that.
File is of course uploaded and all files are in the correct folders.

20 Oct 2022, 1:21 AM
#289
carlwhat avatar

carlwhat

zennedOut

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

Re: Square WebPay support thread.

todoonada:

File is of course uploaded and all files are in the correct folders.

:laugh::laugh:

of course they are....

that information you are seeing is coming from square using javascript. there is no translation possible from the ZC side.

it does seem like one could set the locale.

that would need to get done here:

includes/modules/pages/checkout_payment/jscript_square_webPay.php

unfortunately, i do not have the time to explore that at this moment. other projects await...

perhaps some other adventurous soul from this board might find out how to that and graciously post the results back.

best.

20 Oct 2022, 1:33 AM
#290
todoonada avatar

todoonada

Zen Follower

Join Date:
Nov 2006
Posts:
127
Plugin Contributions:
0

Re: Square WebPay support thread.

Thanks for your quick answer. I feared I would not have direct influence by changing any language file.
I tried changing the browser language and OS language, but it was still in English.
I will look into the link and file you gave me.

20 Oct 2022, 1:39 AM
#291
carlwhat avatar

carlwhat

zennedOut

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

Re: Square WebPay support thread.

todoonada:

Thanks for your quick answer. I feared I would not have direct influence by changing any language file.
I tried changing the browser language and OS language, but it was still in English.
I will look into the link and file you gave me.

who loves ya. look at the aforementioned file, add the set locale in the proper spot:

        document.addEventListener('DOMContentLoaded', async function () {
            if (!window.Square) {
                throw new Error('Square.js failed to load properly');
            }

            const payments = window.Square.payments(appId, locationId);
            payments.setLocale('es');
            let card;

that worked for me.

what other language codes would work, you would have to further examine the docs.

20 Oct 2022, 2:00 AM
#292
todoonada avatar

todoonada

Zen Follower

Join Date:
Nov 2006
Posts:
127
Plugin Contributions:
0

Re: Square WebPay support thread.

Thanks a lot. I will try it.
I read the link you gave me and it says about setLocale:
*If this method is not called explicitly, the user's browser language specified by navigator.language will be used instead.
*I use Vivaldi as browser and changed the UI language. Nothing happened. Still English display.I tried Firefox then and after changing the UI language there, the text was displayed in the desired language.

I should have tried another browser before wasting your time. Anyway I will try to force the locale, following your code sample.

20 Oct 2022, 2:44 AM
#293
todoonada avatar

todoonada

Zen Follower

Join Date:
Nov 2006
Posts:
127
Plugin Contributions:
0

Re: Square WebPay support thread.

I can confirm carlwhat's fix for Japanese.
Now the displayed language foe Square payment is Japanese, even if the UI language of the browser is not.
It works on Firefox, but not in Vivaldi. That seems to be a problem of Vivaldi, though.

20 Oct 2022, 3:53 AM
#294
carlwhat avatar

carlwhat

zennedOut

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

Re: Square WebPay support thread.

todoonada:

I can confirm carlwhat's fix for Japanese.
Now the displayed language foe Square payment is Japanese, even if the UI language of the browser is not.
It works on Firefox, but not in Vivaldi. That seems to be a problem of Vivaldi, though.

どういたしまして

27 Oct 2022, 5:50 AM
#295
todoonada avatar

todoonada

Zen Follower

Join Date:
Nov 2006
Posts:
127
Plugin Contributions:
0

Re: Square WebPay support thread.

The WebPay module works great.

When I go to old orders which have been paid with the old Square payment module, I can not see what the customers ordered. I get an error
PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_SQUARE_APPLICATION_ID" in /includes/modules/payment/square.php:544

I followed the upgrade instructions here: https://docs.zen-cart.com/user/payment/square/
In those instructions a new application is created for the WebPay module on the Square site. So Application ID and Application Secret are different form the old application used for the old Square module. I guess this is the reason the old orders do not show up.
Now I wonder if I change Application ID and Application Secret in the new WebPay module to the former ID and Secret, the old order will be displayed again.

I just could try it, but I got the shop running and do not want to risk messing everything up.

SO I want to ask if anybody got experience with this.

27 Oct 2022, 9:59 AM
#296
brent avatar

brent

Totally Zenned

Join Date:
Mar 2005
Location:
United Kingdom
Posts:
606
Plugin Contributions:
0

Re: Square WebPay support thread.

todoonada:

The WebPay module works great.

When I go to old orders which have been paid with the old Square payment module, I can not see what the customers ordered. I get an error
PHP Fatal error: Uncaught Error: Undefined constant "MODULE_PAYMENT_SQUARE_APPLICATION_ID" in /includes/modules/payment/square.php:544

I followed the upgrade instructions here: https://docs.zen-cart.com/user/payment/square/
In those instructions a new application is created for the WebPay module on the Square site. So Application ID and Application Secret are different form the old application used for the old Square module. I guess this is the reason the old orders do not show up.
Now I wonder if I change Application ID and Application Secret in the new WebPay module to the former ID and Secret, the old order will be displayed again.

I just could try it, but I got the shop running and do not want to risk messing everything up.

SO I want to ask if anybody got experience with this.

Have a look at post 131
It isn't strictly the correct way to do it as it doesn't fix the root cause but does solve the problem (if you don't need to keep track of which module was used to take the payment).

27 Oct 2022, 2:20 PM
#297
carlwhat avatar

carlwhat

zennedOut

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

Re: Square WebPay support thread.

todoonada:

The WebPay module works great...
:thumbsup:

29 Oct 2022, 11:16 PM
#298
carlwhat avatar

carlwhat

zennedOut

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

Re: Square WebPay support thread.

v1.0.2 has been released to the community, and i wanted to say a few words about it.

  • if you are installing square webPay for the first time, this is the version to use.
  • if you are currently running v1.0.1 with no errors, then there is NO need to upgrade.
  • if you have having errors in your processing, v1.0.2 provides a little better help in troubleshooting.
  • if your store is installed in a subfolder, then you should definitely upgrade to v1.0.2.
  • if you are looking for a language other than english, then v1.0.2 is definitely the way to go.

allow me to say a few things about some of these issues.

square makes use of two tokens; one is the OAuth token, the other token is for the specific customer transaction and points to the cardholder information on the square servers. if you are having problems with your OAuth token, that means the merchant can not process ANY transactions. if you have problems with the cardholder token, that is for the individual transaction.

if you have followed this thread, you may have noticed that there was a lot of work done to ensure that square plays nice with OPC. that problem was with the cardholder token. if you are running into problems with the handler that problem is with your OAuth token.

in general, cardholder token problems should come up on the console of the browser prior to final submittal to square. once submitted to square, any problems with processing the transaction will result in a message to your customer using the zen-cart message stack.

sporadic problems with cardholder tokens are most likely indicative of javascript problems. these can be quite difficult to troubleshoot.

with v1.0.2, problems with your OAuth token are much easier to troubleshoot. you can turn verbose to true in the squareWebPay_handler.php file, and logs will get generated that should point you to the problem.

with regards to international support; this is all done on the admin side by entering a 2 character locale setting. the download has docs on where to look for that code; however not all browsers provide international support via the locale setting. this is something that is WAY out of my arena for support; however based on some research on my part after a previous request, it seemed like an easy enough addition to the code. i would think that most major browsers have this feature; but again, way out of my arena for support if it does not work on a specific browser.

as always, support for this module is here on the forum.

best.

30 Oct 2022, 7:22 PM
#299
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.

Installed the new 1.0.2 on 1.5.7d with OPC.

Getting ```
[30-Oct-2022 13:30:25 America/New_York] PHP Fatal error: Uncaught TypeError: Argument 1 passed to square_webPay::saveAccessToken() must be an instance of Square\Models\ObtainTokenResponse, instance of Square\Http\ApiResponse given, called in /includes/modules/payment/square_webPay.php on line 779 and defined in /includes/modules/payment/square_webPay.php:678
Stack trace:
#0 /includes/modules/payment/square_webPay.php(779): square_webPay->saveAccessToken(Object(Square\Http\ApiResponse))
#1 /includes/modules/payment/square_webPay.php(622): square_webPay->renewOAuthToken()
#2 /squareWebPay_handler.php(45): square_webPay->token_refresh_check(false)
#3 {main}
thrown in /includes/modules/payment/square_webPay.php on line 678

[30-Oct-2022 13:30:25 America/New_York] Request URI: /squareWebPay_handler.php, IP address: 68.##.##.122
--> PHP Fatal error: Uncaught TypeError: Argument 1 passed to square_webPay::saveAccessToken() must be an instance of Square\Models\ObtainTokenResponse, instance of Square\Http\ApiResponse given, called in /includes/modules/payment/square_webPay.php on line 779 and defined in /includes/modules/payment/square_webPay.php:678
Stack trace:
#0 /includes/modules/payment/square_webPay.php(779): square_webPay->saveAccessToken(Object(Square\Http\ApiResponse))
#1 /includes/modules/payment/square_webPay.php(622): square_webPay->renewOAuthToken()
#2 /squareWebPay_handler.php(45): square_webPay->token_refresh_check(false)
#3 {main}
thrown in /includes/modules/payment/square_webPay.php on line 678.

30 Oct 2022, 8:03 PM
#300
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.

Another site with 1.0.2 and OPC gets a token warning when the customer has an autofill in Chrome for the CC and does not press enter on the CC Zip before clicking on the confirm order button.

Looks like we may have to work out a way for OPC to ensure the CC is fully active before the confirm order is clicked. You agree?