Zen Cart Logo
Forums / Addon Payment Modules / Square Payment Module for Zen Cart [Support Thread]

Square Payment Module for Zen Cart [Support Thread]

Sticky

Views: 366,769

Results 181 to 200 of 835
15 Aug 2018, 6:31 PM
#181
redradar avatar

redradar

New Zenner

Join Date:
Mar 2006
Location:
San Francisco, CA
Posts:
44
Plugin Contributions:
0

Square Payment Module for Zen Cart [Support Thread]

Thank you so much, DrByte! That was it -- due to the e-mail error codes we received we were substituting our personal access token for the OAuth application secret and wondering why were weren't seeing the green button to authorize the app. Thank you for highlighting that difference for us. Once we reinstalled the app and tested it, everything is now working perfectly again. Much gratitude to you -- we really appreciate your quick answer, insight and direction!

12 Sep 2018, 2:37 AM
#182
gerrim avatar

gerrim

New Zenner

Join Date:
Jul 2013
Location:
Brisbane, Australia
Posts:
39
Plugin Contributions:
0

Re: Square Payment Module for Zen Cart [Support Thread]

Hi. I was hoping someone could please help with an error re the cron job to automatically handle token refreshes.

Cron job installed via cPanel on server:

php /home/my_username/public_html/square_handler.php

Error Log:

[12-Sep-2018 12:05:02 Australia/Brisbane] PHP Fatal error: Uncaught Error: Class 'square' not found in /home/my_username/public_html/square_handler.php:19
Stack trace:
#0 {main}
thrown in /home/my_username/public_html/square_handler.php on line 19

Email returned:

Status: 500 Internal Server Error
X-Powered-By: PHP/7.0.31
Access-Control-Allow-Origin: *
Set-Cookie: cookie_test=please_accept_for_session; expires=Fri, 12-Oct-2018 02:05:02 GMT; Max-Age=2592000; path=/; domain=recoveredheritage.com.au
Set-Cookie: zcrm_ac08606c3ae64282ac69e5945c47bda5=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=recoveredheritage.com.au
Content-Type: text/html; charset=utf-8

My situation:
Square v0.94 installed successfully and all looks OK in Admin
ZC1.5.5e (modified with plugins)
Website: recoveredheritage.com.au. Still under development (maintenance mode currently on but the error persists even when its off).

Line 19 of that file states > $square = new square;. I tried re-uploading all the SQUARE plugin files in case I missed one in the classes directory somehow - but error persists. As yet, I haven't been able to find a solution or the problem discussed in either the zencart or general community. Can anyone point me in the right direction to resolve this please?

Thanks.

12 Sep 2018, 10:01 AM
#183
dbltoe avatar

dbltoe

Totally Zenned

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

Re: Square Payment Module for Zen Cart [Support Thread]

Getting similar results on four sites, but sporadically. All four cron settings are exactly the same (Other than the username, of course)

None error every time the cron is run.

One only throws a debug file occasionally.

Two throw no debug files but email with different cron errors. Both are 500 errors with different coding.

One actually resets the mod to false.

12 Sep 2018, 12:24 PM
#184
dbltoe avatar

dbltoe

Totally Zenned

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

Re: Square Payment Module for Zen Cart [Support Thread]

Discovered that our 500 errors was that Perl Module for https was not installed on the server for some reason. One was a typo.

Still can't tell what caused the debug or whether the Perl fix will stop that from happening.

We will see after cron run.

12 Sep 2018, 10:38 PM
#185
gerrim avatar

gerrim

New Zenner

Join Date:
Jul 2013
Location:
Brisbane, Australia
Posts:
39
Plugin Contributions:
0

Re: Square Payment Module for Zen Cart [Support Thread]

Discovered that our 500 errors was that Perl Module for https was not installed on the server for some reason.

Thank you dbltoe. I appreciate your assistance.

I'm a real newie here so don't really know what I'm doing...but I tried to muddle my way through. But, my attempt was unsuccessful: same error log generated when cron job ran. Are you able to give more specific instructions?

Attempt details: My ISP server (inDesign) was showing no Perl modules installed. l looked at the available Perl modules and there's one called Business::OnlinePayment:HTTPS. Installed this. Now the installed Perl includes that one + Net::HTTPS::Any + Tie::IxHash.

Thanks

18 Sep 2018, 7:20 PM
#186
haredo avatar

haredo

Totally Zenned

Join Date:
Apr 2006
Location:
Texas
Posts:
6,176
Plugin Contributions:
0

Re: Square Payment Module for Zen Cart [Support Thread]

@DrBytes which .php file generates the call for the text to appear when you start typing in your credit card number?
Example when start typing 42 I notice the page refresh and visa appears. Notice it’s lower case but their logo is VISA. I notice the same when typing in 52 which shows masterCard and I want it to show MasterCard. Also americanExpress & discover.
It’s just cosmetic if you have the time please.
I used the developers tool kit and could not find masterCard & also search in the database with no avail. Is the call embed in hex code?

With @lat9 help I received this answer.
On further inspection (aren't demo sites wonderful?), it appears that the text is being added by the Square payment method's jQuery (see /includes/modules/pages/checkout_one/jscript_square.php). The values displayed appear to be coming back from an AJAX call to Square.

Mark

26 Sep 2018, 12:48 AM
#187
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Square Payment Module for Zen Cart [Support Thread]

GerriM:

PHP Fatal error: Uncaught Error: Class 'square' not found in /home/my_username/public_html/square_handler.php:19
thrown in /home/my_username/public_html/square_handler.php on line 19
Line 19 is trying to execute the Square module code, but it's not been loaded into memory yet.
Line 18 does the loading by passing the name of the module whose files should be loaded. But they won't load if the files aren't found in the proper locations.

I suspect you've missed uploading some files for the module. Line 18 expects at least these 2 files:
/includes/modules/payment/square.php
/includes/languages/english/modules/payment/square.php
There are lots of other important files related to the Square module, but if these aren't present then line 18 will fail, which will cause line 19 to give the error you quoted.

26 Sep 2018, 7:15 PM
#188
dbltoe avatar

dbltoe

Totally Zenned

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

Re: Square Payment Module for Zen Cart [Support Thread]

All sites getting this debug file has the files in the required places. The debug happens when the cron job runs in cpanel or when square_handler.php is run from the browser.

An example of the emailed code:

Status: 500 Internal Server ErrorAccess-Control-Allow-Origin: *
Set-Cookie: **************; domain=.*******.com; secure; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Type: text/html; charset=utf-8
```This is after the Perl fix.
26 Sep 2018, 7:24 PM
#189
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Square Payment Module for Zen Cart [Support Thread]

Could be that the cron job is running a different (older) version of PHP too.

26 Sep 2018, 8:35 PM
#190
dbltoe avatar

dbltoe

Totally Zenned

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

Re: Square Payment Module for Zen Cart [Support Thread]

Sites are running 5.6

Server 7.1

26 Sep 2018, 9:35 PM
#191
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Square Payment Module for Zen Cart [Support Thread]

dbltoe:

Getting similar results on four sites, but sporadically. All four cron settings are exactly the same (Other than the username, of course)

None error every time the cron is run.

One only throws a debug file occasionally.

Two throw no debug files but email with different cron errors. Both are 500 errors with different coding.

One actually resets the mod to false.

dbltoe:

All sites getting this debug file has the files in the required places. The debug happens when the cron job runs in cpanel or when square_handler.php is run from the browser.

An example of the emailed code:

Status: 500 Internal Server ErrorAccess-Control-Allow-Origin: *
Set-Cookie: **************; domain=.*******.com; secure; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Type: text/html; charset=utf-8


Okay, since a 500 is being triggered, what's the PHP error recorded for it?
26 Sep 2018, 11:21 PM
#192
dbltoe avatar

dbltoe

Totally Zenned

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

Re: Square Payment Module for Zen Cart [Support Thread]

PHP Fatal error: Uncaught Error: Class 'square' not found in /home/my_username/public_html/square_handler.php:19
thrown in /home/my_username/public_html/square_handler.php on line 19

27 Sep 2018, 5:05 AM
#193
gerrim avatar

gerrim

New Zenner

Join Date:
Jul 2013
Location:
Brisbane, Australia
Posts:
39
Plugin Contributions:
0

Re: Square Payment Module for Zen Cart [Support Thread]

dbltoe:

PHP Fatal error: Uncaught Error: Class 'square' not found in /home/my_username/public_html/square_handler.php:19
thrown in /home/my_username/public_html/square_handler.php on line 19

Thanks FYI & Dr Byte for your replies. After trying a lot of things and hitting brick walls, while I'm not sure if I've resolved the issue...something has changed: I'm no longer getting any emails or error logs when the cron job runs.

I came across an internet reference to running cron jobs with a slightly different command - and that seemed to do the trick:

/usr/local/bin/php /home/<myUserID>/public_html/square_handler.php (with extra text in red compared to Zen Cart info)

A Question: Is there any way to confirm that token has been refreshed (no indicator that I can find in ZC Admin/Square dashboard)? I've set our ISP cPanel to receive an email "every time it runs a command which produces output". So...if there's no email generated and no error log, does that mean I can safely assume the cron job has run - and that no email is normal?

BTW:

  • to try and force some cron job output - I tried (1) adding an extra line to the *square_handler.php *to force some output > echo "done";, (2) changing setting in Square Config to always send an email (not just logging/emailing on errors) - but neither worked;
  • FYI dbltoe, prior to attempting the solution above, I confirmed that Perl Module for https was installed.

Thanks again

27 Sep 2018, 5:28 AM
#194
gerrim avatar

gerrim

New Zenner

Join Date:
Jul 2013
Location:
Brisbane, Australia
Posts:
39
Plugin Contributions:
0

Re: Square Payment Module for Zen Cart [Support Thread]

New topic: while trying to resolve the error log above, I came across this API alert on my Square Dashboard:

There is a newer version of the Connect APIs available. Please consider upgrading.

                    Changing your API version may break your implementation. We recommend checking the             [                  changelog              ](https://docs.connect.squareup.com/changelog/summary-connect)              before upgrading.

and then the changelog states:

Square-Version: 2018-09-18
Adds a new Connect v2 API for inventory tracking, and updates the Customers API to support birthdays in customer profiles.

Obviously a recent change. I haven't clicked the Change Version button yet. Since I may not have even fixed the cron job issue above, I thought I should check back with you experts first for your recommendation - and it may be relevant to other ZC Square users.

27 Sep 2018, 1:39 PM
#195
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Square Payment Module for Zen Cart [Support Thread]

GerriM:

New topic: while trying to resolve the error log above, I came across this API alert on my Square Dashboard:

There is a newer version of the Connect APIs available. Please consider upgrading.

Changing your API version may break your implementation. We recommend checking the changelog before upgrading.

and then the changelog states:

Square-Version: 2018-09-18
Adds a new Connect v2 API for inventory tracking, and updates the Customers API to support birthdays in customer profiles.

Obviously a recent change. I haven't clicked the Change Version button yet. Since I may not have even fixed the cron job issue above, I thought I should check back with you experts first for your recommendation - and it may be relevant to other ZC Square users.
Not necessary at this time.

27 Sep 2018, 1:42 PM
#196
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Square Payment Module for Zen Cart [Support Thread]

GerriM:

I came across an internet reference to running cron jobs with a slightly different command - and that seemed to do the trick:

/usr/local/bin/php /home/<myUserID>/public_html/square_handler.php (with extra text in red compared to Zen Cart info)
The extra path parameters you added (shown in red) are fine. There's no way for us to know "for sure" what directory PHP is installed in, so the instructions we provide are the most generic, and then if more specificity is required then your own hosting company knows your server best so they should be consulted for that. Setting up and supporting cron jobs is something best done in collaboration with your hosting company.

But adding the specific path to the php binary, as you've done, does control and force the specific version of PHP to be used ... which is generally better.

27 Sep 2018, 1:47 PM
#197
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Square Payment Module for Zen Cart [Support Thread]

GerriM:

A Question: Is there any way to confirm that token has been refreshed (no indicator that I can find in ZC Admin/Square dashboard)? I've set our ISP cPanel to receive an email "every time it runs a command which produces output". So...if there's no email generated and no error log, does that mean I can safely assume the cron job has run - and that no email is normal?
To get descriptive output for debugging, you can TEMPORARILY edit square_handler.php and change line 11, which says:

$verbose = false;
``` and change false to true.
NOTE that this may prevent normal transactions from operating properly until you put it back to false.

With $verbose=true, it will give output with one of:
not configured = module doesn't have an Application ID set
failure = token expired more than 15 days ago, or no token available to refresh
refreshed = the job refreshed the token
not refreshed = a refresh was attempted, but did not complete properly
not expired = a token exists but it is younger than 3 weeks old, so no need to refresh
1 Oct 2018, 1:40 PM
#198
jakelawless avatar

jakelawless

Zen Follower

Join Date:
Jan 2018
Posts:
146
Plugin Contributions:
0

Re: Square Payment Module for Zen Cart [Support Thread]

Starting using Square and it seems as if its working, just one question. Is there anyway to fix this or edit the layout of it? Thanks
Attachment 18062

1 Oct 2018, 1:47 PM
#199
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Square Payment Module for Zen Cart [Support Thread]

JakeLawless:

Starting using Square and it seems as if its working, just one question. Is there anyway to fix this or edit the layout of it? Thanks
Attachment 18062
That seems like a CSS issue with your template. Do you get the same display issue if you enable Authorizenet-AIM module? Which template are you using?

1 Oct 2018, 2:23 PM
#200
jakelawless avatar

jakelawless

Zen Follower

Join Date:
Jan 2018
Posts:
146
Plugin Contributions:
0

Re: Square Payment Module for Zen Cart [Support Thread]

Thanks for quick reply. There's no issue when using Authorizenet-AIM. The template im using is a TemplateMonster template called 'Spare Parts Zen Cart'

This is how it looks with Authorizenet-AIM:
Attachment 18063