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,790

Results 401 to 420 of 835
7 Apr 2020, 2:58 AM
#401
mvstudio avatar

mvstudio

Zen Follower

Join Date:
Apr 2008
Posts:
447
Plugin Contributions:
1

Square Payment Module for Zen Cart [Support Thread]

mc12345678:

Any idea what modified includes/functions/functions_osh_update.php away from the ZC installed version? There aren't even 200 lines in the original file...

I haven't modified that file. Is there any known plugin that could create that kind of issue?

Correction! Yes, there is a plugin that makes modifications to that file, TY Tracker. But I've never had that happen before. Weird.

7 Apr 2020, 6:04 PM
#402
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 7.2 is causing an error in line 1110 of includes/modules/payment/square.php.```
[07-Apr-2020 17:35:49 UTC] Request URI: /Ud;reW/orders.php?origin=index&page=1&oID=1718&action=doRefund, IP address: 123.231.145.199#1 square->_doRefund() called at [/home/allpecans/public_html/Ud;reW/orders.php:254]
--> PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/Ud;reW/public_html/includes/modules/payment/square.php on line 1110.


Am I correct in assuming (I know) that ```
        if (count($errors_object)) {            $error = $this->parse_error_response($errors_object);
            $messageStack->add_session(MODULE_PAYMENT_SQUARE_TEXT_UPDATE_FAILED . ' [' . $error['detail'] . ']', 'error');


            return false;
        }
```should be```
        if (empty($errors_object) && is_array($errors_object)) {            $error = $this->parse_error_response($errors_object);
            $messageStack->add_session(MODULE_PAYMENT_SQUARE_TEXT_UPDATE_FAILED . ' [' . $error['detail'] . ']', 'error');


            return false;
        }
7 Apr 2020, 6:57 PM
#403
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

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

Square v1.0 is causing problems so I need to turn it OFF/False and resort to using Auth.net AIM

In admin payment modules, select Square.
Edit and Remove buttons appear on the right side of the screen along with all the settings just below that.
Click Edit so that I can change the ENABLE SQUARE MODULE from true to false
The right column just turns to blank white space. No debug file generated.
Thus, Square cannot be disabled, edited, nothing.

The only thing that I know has been done since Square functionality was verified is install OPC 2.3.0 and EditOrders 4.5

TNX for helping

7 Apr 2020, 7:44 PM
#404
carlwhat avatar

carlwhat

zennedOut

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

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

dbltoe:

PHP 7.2 is causing an error in line 1110 of includes/modules/payment/square.php.```
[07-Apr-2020 17:35:49 UTC] Request URI: /Ud;reW/orders.php?origin=index&page=1&oID=1718&action=doRefund, IP address: 123.231.145.199#1 square->_doRefund() called at [/home/allpecans/public_html/Ud;reW/orders.php:254]
--> PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/Ud;reW/public_html/includes/modules/payment/square.php on line 1110.

> 
> Am I correct in assuming (I know) that ```
        if (count($errors_object)) {            $error = $this->parse_error_response($errors_object);
            $messageStack->add_session(MODULE_PAYMENT_SQUARE_TEXT_UPDATE_FAILED . ' [' . $error['detail'] . ']', 'error');


            return false;
        }
```should be```
        if (empty($errors_object) && is_array($errors_object)) {            $error = $this->parse_error_response($errors_object);
            $messageStack->add_session(MODULE_PAYMENT_SQUARE_TEXT_UPDATE_FAILED . ' [' . $error['detail'] . ']', 'error');


            return false;
        }
  • your code changes are NOT from line 1110. what makes you think those changes will work? and more importantly that is where the problem is?
  • i'm guessing that you are using v155? as line 1110 on v156 is commented out.
  • i do not think the change you have listed will help. i think the issue starts at line 333.
  • i would try and figure out why you have an exception there as opposed to fixing the code. that part of the code looks unchanged to zc156.
  • while i used to be a fan of quick fixes like you are showing here (not that i think you are fixing in the right place); i think vars should be properly initiated as opposed to checking them everytime you are using them. in this situation, its tricky as i'm not sure what the square response is (i do not use the module.)

i hope that helps.

7 Apr 2020, 7:58 PM
#405
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]

Those files are from the latest download of the plugin which is newer than the release of 1.5.6c

We have had dual problems with Square. First, Square updated the API in late March.

Second, The latest download for Square is WAY different (over 100) than stock 1.5.6c

7 Apr 2020, 9:37 PM
#406
carlwhat avatar

carlwhat

zennedOut

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

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

dbltoe:

Those files are from the latest download of the plugin which is newer than the release of 1.5.6c

We have had dual problems with Square. First, Square updated the API in late March.

Second, The latest download for Square is WAY different (over 100) than stock 1.5.6c

i would still find out what is in $errors_object first before modifying the code.

in addition, looking at v157, if you have logging turned on, there should be a log file that can tell you exactly what the problem is. it looks like you are doing a refund. correct? what does the log say about the refund?

again, i have not used square before, but i know refunds are tricky. was the transaction settled? does square do voids (the function exists there).

i suppose you could look make this change that you are talking about. you are already at the end of the function, and this is just adding the error to the messageStack. but the error is not in the expected format. why? the log file can give you an indication...

hope that helps.

7 Apr 2020, 10:00 PM
#407
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

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

[QUOTE=dbltoe;1367411]PHP 7.2 is causing an error in line 1110 of includes/modules/payment/square.php.```
[07-Apr-2020 17:35:49 UTC] Request URI: /Ud;reW/orders.php?origin=index&page=1&oID=1718&action=doRefund, IP address: 123.231.145.199#1 square->_doRefund() called at [/home/allpecans/public_html/Ud;reW/orders.php:254]
--> PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/Ud;reW/public_html/includes/modules/payment/square.php on line 1110.


Just removed and reinstalled SQUARE 1.0.
1.  Resolved my editing issue above.

2.  Receive the EXACT same myDEBUG file when refunded the 1st test transaction.

AFAIK, Square does not do voids.  Transaction was refunded within a minute of being authorized and captured.
7 Apr 2020, 10:05 PM
#408
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]

Are we starting to channel RodG or are you still upset about RixStix not including you in the "Good Guy List"?:P:hug:

PHP states that ANY use of count() with 7.2 will generate the warning listed. At https://www.php.net/manual/en/function.count.php you will need to scroll down to Change Log to see their statement.

I did not say there was any error in operation of the cart. > PHP 7.2 is causing an error in line 1110 of includes/modules/payment/square.php.Maybe I should have said warning.

I simply wanted to know if the replacement code was correct in order to stop the warning, which stops the customer from texting, which stops me from having to spend time on a warning, which causes me to...............................

7 Apr 2020, 10:08 PM
#409
carlwhat avatar

carlwhat

zennedOut

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

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

again, where is the log file?

the process that you just talked about, would be a void. there is a _doVoid function in the square payment class.

my guess is that you are trying to refund a transaction that has not been settled and your only option is to void it. but the square log file would tell you that.

now why the square class allows you to refund this transaction is a different story. but i'm guessing that is where the problem is.

7 Apr 2020, 10:21 PM
#410
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]

Used a tester that says the code is correct, so I'll just take my mole hill on down the road.:cheers:

7 Apr 2020, 11:26 PM
#411
carlwhat avatar

carlwhat

zennedOut

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

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

dbltoe:

Are we starting to channel RodG or are you still upset about RixStix not including you in the "Good Guy List"?:P:hug:

PHP states that ANY use of count() with 7.2 will generate the warning listed. At https://www.php.net/manual/en/function.count.php you will need to scroll down to Change Log to see their statement.

I did not say there was any error in operation of the cart. Maybe I should have said warning.

I simply wanted to know if the replacement code was correct in order to stop the warning, which stops the customer from texting, which stops me from having to spend time on a warning, which causes me to...............................

last time, and i'm really done....

i am not at all upset. at all... the only thing that makes me upset is a comparison to rodG....

i'm just trying to help with the code. that is all....

WARNINGS will eventually turn to ERRORS which is a good reason to address them now; prior to a newer version of php which will say they are errors.

if the refund succeeded without problem, i do not understand the code. my concern is to help with the code.... and to not be compared to.... others.... that is all...

your code will address that problem, but if the result of return errors is NOT either an EMPTY array or a filled ARRAY (lines 1100 or 1104) the code needs to be fixed. IMO.

now get back out there and #stayathome.

best.

9 Apr 2020, 6:05 PM
#413
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]

Couple of things not addressed or gone over a little lightly in either readme

This addresses UPGRADES

Up until just a couple of days ago, Square defaulted to sandbox when you entered your app. You could really get lost if you did not see that. Our current pages from Square show that they have defaulted to Production which should help. Just think the lack of sandbox for ZC should be more than line 129 in the MD

Couldn't find information in either readme regarding the changing of the API version for existing apps (some have not updated since their original creation. The latest version is 2020-03-25. The files with this new ZC version imply that this is the version needed for 1.1 to work. Version 1.0 API files listed 2020-02-26 yet nothing in the docs mentioned whether the user had to upgrade the API in square. We had several customers who were having problems that wound up being old API versions. It appears that 1.0 needed 2020-02-26. Nothing in the docs would have notified the user to change from an older version.

Since the API setting is "below the fold" on the app's landing page, it looks like most may have missed this.

Also, since the 2020-03-25 marks the start of Square's V2 of the API, I fear that only the new installs will work as most of the old installs will have an outdated API version.

BOTTOM LINE
If you are upgrading from any version prior to 1.1:

  1. (Login to https://squareup.com/dashboard/apps and click on My Apps.
  2. Click the Manage App button next to your listed App.
  3. Make sure you are in Production as Sandbox is not used with Zen Cart
  4. Scroll down to the API Version settings:
  5. For version 1.1 of this mod, make sure your Production API Version is at least version 2020-03-25 or later.
  6. .................
9 Apr 2020, 6:11 PM
#414
drbyte avatar

drbyte

Sensei

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

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

@dbltoe - thanks for posting this.

I would have expected it to automatically use the right API version, since the SDK (which this module uses since v1.0) passes the API version it's written for, so should override what's set in the merchant account. (This is the behavior that other systems use, hence the assumption.)

9 Apr 2020, 6:41 PM
#415
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]

That's what got me pulling my hair out, what little of it there is. We found the opposite to be true.

Folks who had established an APP prior with 0.97 or earlier were having difficulties, no debugs, and a blank page when trying to edit in the admin.

We found each had old API dates and bringing them current, removing Square, and reinstalling Square got them on the right track.

I have no way of testing other sites for this from the older versions as we have fixes them already.

Note: Square will let you go back in time in the API selection:ohmy:

9 Apr 2020, 7:22 PM
#416
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

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

TNX dbltoe,

Crap, **I didn't realize that I am 19 versions behind. **I didn't read that I needed to do anything within the Square account before using the plugin. Heck, that might be why Square has been the most problematic payment method that I've used in 10 years.

Another job just got moved up in the priority list for this afternoon.

I don't feel I can cancel the Auth.net account yet because Square has required remove/reinstall 3 times since I upgraded to zc156c just a week or so ago.

dbltoe:

Couple of things not addressed or gone over a little lightly in either readme

This addresses UPGRADES

Up until just a couple of days ago, Square defaulted to sandbox when you entered your app. You could really get lost if you did not see that. Our current pages from Square show that they have defaulted to Production which should help. Just think the lack of sandbox for ZC should be more than line 129 in the MD

Couldn't find information in either readme regarding the changing of the API version for existing apps (some have not updated since their original creation. The latest version is 2020-03-25. The files with this new ZC version imply that this is the version needed for 1.1 to work. Version 1.0 API files listed 2020-02-26 yet nothing in the docs mentioned whether the user had to upgrade the API in square. We had several customers who were having problems that wound up being old API versions. It appears that 1.0 needed 2020-02-26. Nothing in the docs would have notified the user to change from an older version.

Since the API setting is "below the fold" on the app's landing page, it looks like most may have missed this.

Also, since the 2020-03-25 marks the start of Square's V2 of the API, I fear that only the new installs will work as most of the old installs will have an outdated API version.

BOTTOM LINE
If you are upgrading from any version prior to 1.1:

  1. (Login to https://squareup.com/dashboard/apps and click on My Apps.
  1. Click the Manage App button next to your listed App.
  1. Make sure you are in Production as Sandbox is not used with Zen Cart
  1. Scroll down to the API Version settings:
  1. For version 1.1 of this mod, make sure your Production API Version is at least version 2020-03-25 or later.
  1. .................
9 Apr 2020, 7:58 PM
#417
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]

Glad we may get the situation fixed.

This is the very reason for my post. It MAY be that versions 1.0 and later automatically use the right version. I'm from Missouri on that one.

I'm sure drbyte will get us all back on the right track and soon.

added:

This might also be why I was unable to understand customer's problems with square. Never thought to query them on their API version.

9 Apr 2020, 8:04 PM
#418
drbyte avatar

drbyte

Sensei

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

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

dbltoe:

Never thought to query them on their API version.
Me too.

9 Apr 2020, 8:13 PM
#419
drbyte avatar

drbyte

Sensei

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

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

I've updated the docs and the zip to add dbltoe's points around upgrading.

9 Apr 2020, 11:27 PM
#420
rixstix avatar

rixstix

Totally Zenned

Join Date:
Aug 2009
Location:
North Idaho, USA
Posts:
2,015
Plugin Contributions:
0

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

Sorry for what is probably a seemingly dumb question

When updating the Square App to the one that matches the latest ZC square plugin, there is a checkbox

Change my webhook endpoints to use this API version

Should that box be checked or unchecked?