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

Results 641 to 660 of 835
16 Aug 2021, 1:47 PM
#641
mrpix avatar

mrpix

New Zenner

Join Date:
Jun 2021
Location:
UK
Posts:
8
Plugin Contributions:
0

Square Payment Module for Zen Cart [Support Thread]

MrPix:

Thanks for the info, new to Zencart and not had to do any updates yet.

I did try to update, but after uploading the 1.5.7>1.5.7b files (after renaming the admin folder) I just get a blank screen (admin only) so I need to work out what needs to happen to rectify that I guess before proceeding.

I'll be in touch once I've worked the update(s) out and tested it with the new files.

Hi @RocketSites and @Congerman

I have updated now to 1.5.7c and am getting the same problem as before with the 2 new files you have kindly provided:

The "continue" button just does not work transitioning from Step 2 to Step 3 in the checkout process. I have tried a bunch of browsers and 3 machines on different network and get the same result.

Any ideas?

Thank you

16 Aug 2021, 4:02 PM
#642
mrpix avatar

mrpix

New Zenner

Join Date:
Jun 2021
Location:
UK
Posts:
8
Plugin Contributions:
0

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

RocketSites:

Hi,

This sounds like a JS error, could be as simple as a cache issue. Can you provide your website URL and confirm that I can create a customer account to test please?

Hi, the store is https://www.trikstore.uk, feel free to create an account to test with (sorry I missed this reply way back).
Thanks for all your help.

25 Aug 2021, 11:07 AM
#643
mrpix avatar

mrpix

New Zenner

Join Date:
Jun 2021
Location:
UK
Posts:
8
Plugin Contributions:
0

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

as a further follow up, I created another zen-cart shop and opened another Square account, but in my name.... the domain is different but it is on the same hosting server and I get the same results: transactions go through OK before changing to the 2 new files, but the Continue button does not seem to do anything between step 2 and 3 once swapped over.

I am using the 20200528 API (reported as 16 versions behind in the Square portal - is this the correct one to use?) and the 1.5 square module with Zencart 1.57c on PHP 7.4.... could it be a hosting server issue?

5 Sep 2021, 2:07 PM
#644
mrpix avatar

mrpix

New Zenner

Join Date:
Jun 2021
Location:
UK
Posts:
8
Plugin Contributions:
0

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

Not sure if I am alone here? Can anybody help please?

I have found an error when trying to progress from step to to step 3 on the payment....

Uncaught TypeError: locationId is required

any ideas ...anybody?

TIA

9 Sep 2021, 6:36 PM
#645
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]

zen cart 157c
PHP: 7.3.30

Cron Error in Cpanel

Automatic Token Refreshing via cron

This is optional. For low-traffic stores, this is recommended.

In the initial setup, you clicked that "green button" to activate the module by setting what's called a Refresh Token. This token will expire in 45 days if no transactions are made. (30 days expiration, plus 15 days grace period.) After the 30 days you will see the green "Get Access Token" button again in your store Admin, and will need to click it to reactivate the module as you did during initial setup.
With regular transaction activity the token will refresh itself, but this can come at the expense of a brief delay for random customers. To avoid the possibility of such delays, or expiration due to inactivity, we recommend that you set up a "cron job" on your server to automatically handle token refreshes without interfering with customer checkout activity.
To set up the cron job, go to the cron settings in your website hosting company's control panel, and create a new task to run every 3 days at 1am. The command for the task will be:
php /home/user/your/path/to/wherever/is/square_handler.php
Again, if your token expires, Square will no longer show up during checkout for your customers. But you can fix it manually by clicking the green button to "login and authorize your account" as described in the Configuration section above.

When applying the php code to run the cron below.

php /home/xxxxxxxxxxx/public_html/square_handler.php

I receive the following log file

PHP Fatal error:  Uncaught Error: Class 'square' not found in /home/xxxxxxxxxxxxx/public_html/square_handler.php:21
Stack trace:
#0 {main}
  thrown in /home/xxxxxxxxxxxx/public_html/square_handler.php on line 21
9 Sep 2021, 7:48 PM
#646
dennisns7d avatar

dennisns7d

New Zenner

Join Date:
Jan 2010
Posts:
55
Plugin Contributions:
0

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

This sounds like what I encountered a couple years ago. My "fix" was to add a few lines to square_handler.php:

<?php
/**
 * Callback module for Square payment module
 * Updated 2019-03-15
 */
header('Access-Control-Allow-Origin: *');

$mode = 'cli';
if (!empty($_GET['code'])) {
    $mode = 'web';
}
$verbose = false;
if (!isset($_SERVER['REQUEST_URI'])) $_SERVER['REQUEST_URI'] = __FILE__;    // to avoid PHP notice for CLI
if (!isset($_SERVER['SCRIPT_NAME'])) $_SERVER['SCRIPT_NAME'] = __FILE__;    // to avoid PHP notice for CLI
require 'includes/application_top.php';
if (empty($PHP_SELF)) $PHP_SELF = __FILE__; // ensure that $PHP_SELF is not empty
require DIR_WS_CLASSES . 'payment.php';
if ($mode === 'web' && (empty($_GET['code']) || empty($_GET['state']))) {
    if ($verbose) echo 'INVALID PARAMS';
    http_response_code(400);
    exit(1);
}
$module = new payment('square');
$square = new square;
if ($mode === 'web') {
    if ($verbose) error_log('SQUARE TOKEN REQUEST - auth code for exchange: ' . $_GET['code'] . "\n\n" . print_r($_GET, true));
    $square->exchangeForToken($_GET['code']);
    exit(0);
}
if ($mode === 'cli') {
    if (!defined('MODULE_PAYMENT_SQUARE_STATUS') || MODULE_PAYMENT_SQUARE_STATUS !== 'True') {
        if ($verbose) echo 'MODULE DISABLED';
        http_response_code(417);
        exit(1);
    }
    $is_browser = (isset($_SERVER['HTTP_HOST']) || PHP_SAPI !== 'cli');
    $result = $square->token_refresh_check();
    if ($verbose) echo $result;
    if ($result === 'failure') {
        if (!$is_browser) echo 'Square Token Refresh Failure. See logs.';
        http_response_code(417);
        exit(1);
    }
}
exit(0);

I found that for the host I was using that $PHP_SELF was empty when the script was run via cron and prevented the proper setup of the necessary classes, tripping the failure of creating an instance of the square class. I also squashed a couple PHP notices when patching the bug.

22 Sep 2021, 9:10 PM
#647
muah avatar

muah

Zen Follower

Join Date:
Dec 2008
Location:
USA, North East
Posts:
226
Plugin Contributions:
0

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

Hello Zen Cart-ians, which is what i suppose you'd call people who live in a state called Zen Cart? or would it be Zen Cart-ites?

So I installed Square and all is well until one our site sites gets a notice that selling CBD is not yet allowed, fill out this 20 page application to sell it, include 6 months of bank statements and by the way, we are stopping all money to your bank until resolved. CBD is allowed federally. Thanks to the 2018 Farm Bill (aka the Agricultural Improvement Act of 2018), CBD products are federally legal to produce, purchase, and use if they meet certain conditions. To be federally legal, CBD must be hemp-derived and contain no more than 0.3% THC. The products i sell have 0.0% THC.

Selling CBD and selling CBD with THC are two different worlds. CBD is legal and useful and been selling it for years! But Square now is the problem as they are too big to look into details and just slap that big business protocol without any closer inspection. In other words, they don't know if we sell it with THC and will not investigate. Authorize.net which used to be a straight forward basic information application now requires nearly every single personal identifiable information you have including license, SS, Cell, etc. Fine but then the current 2021 application declares the right to Audit your books at will and to forfeit any future possible litigation against the company should they make a mistake. It's just wow! If they make the mistake, you sign away litigation. It's not enforceable in any court but it's there and you sign it so...who knows.

This is SECTION 8.2 of Authorize sign on contract in case someone doesn't think I'm accurate. Audit. During the term of this Agreement and for two (2) years thereafter, CyberSource shall have the right to examine Merchant’s records, books, systems, controls, processes and procedures (“Records”) for the purpose of verifying Merchant’s compliance with the terms and conditions of this Agreement (“Audit”). Merchant shall provide to the auditors and personnel of CyberSource (“Auditors”) reasonable access to Records and shall cooperate and provide to such Auditors, in a timely manner, all such assistance as they may reasonably require in connection with any such Audit. Except in the event that CyberSource has reasonable basis to believe that Merchant is in violation of any Rules or laws, or in breach of any warranties, CyberSource will provide Merchant no less than five (5) days written notice prior to the date of an Audit, the Audit will be conducted during Merchant’s normal business hours, and Audits shall occur no more than twice in any calendar year.

My question is, is there an exhaustive list of processors that are set up with Zen Cart other than the ones in the plug in section? Square doesn't allow things like CBD or let's say you make art out of used bullets. If the bullets are real, they'll shut down the account because they cannot determine if the bullets are live ammo. Even though you state it's dead ammo and clean and used in this art piece, doesn't cut it. If it says made out of spent dead ammo... it's a shut down. It's all big business iron clad type legalities. Small business would work a little and look! Big business it's just protocol. Authorize.net is so big and now a visa owned company, they pretty much created a one sided contract. All your personal information is shared among it's family of providers as needed to perform their job which means, all that personal information is going to be out there big time. Like to keep it in the USA for the sake of data protection. So back to the question: other than what is listed in the plug in section, are there more credit card processors that are set up to work in Zen or might there be yet another solution? I liked the way it was years ago, the numbers came over split and we just keyed them in. thanks. :)

26 Sep 2021, 1:58 PM
#648
jenny2803 avatar

jenny2803

New Zenner

Join Date:
Jul 2017
Location:
Bulgaria
Posts:
1
Plugin Contributions:
0

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

Hi There,
Can you tell me if this is compatible with a multi designer zencart store.
Jenny

5 Nov 2021, 1:52 AM
#649
todoonada avatar

todoonada

Zen Follower

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

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

Hello,
I still got the following error from time to time:

Error Dump: stdClass Object
(
[errors] => Array
(
[0] => stdClass Object
(
[code] => VALUE_EMPTY
[detail] => Field must not be blank
[field] => source_id
[category] => INVALID_REQUEST_ERROR
)

[1] => stdClass Object
(
[code] => VALUE_EMPTY
[detail] => Field must not be blank
[field] => idempotency_key
[category] => INVALID_REQUEST_ERROR
)

[2] => stdClass Object
(
[code] => MISSING_REQUIRED_PARAMETER
[detail] => Field must be set
[field] => amount_money
[category] => INVALID_REQUEST_ERROR
)
)
)

It happens when a customer wants to check out. I can not find any pattern, why this error occurs. If I charge the customer manually from the Square website, the transaction is succesful.I use Zencart 1.5.6c, Square module 1.5, Square API from 2020-05-28.The Square API is the one which is recommended in Square module 1.5. It is currently 18 versions behind. Does it make sense to upgrade to the newest Square API?

29 Nov 2021, 5:41 PM
#650
mvstudio avatar

mvstudio

Zen Follower

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

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

Hello.

There's what seems to be an unusual occurrence happening with this module. ZC version 1.5.6c, Square version 1.5.

Customers are complaining they cannot checkout, that the credit card module is "stuck on displaying an error" whenever wrong data is entered.

We tested entering an invalid CC number and it displays an error message, as it should. We then entered a valid CC number, all data correctly, but the previous error message continues to display not letting us move forward with checkout. The only way to remove the error message is to go back to checkout_shipping, go back again to checkout_payment and re-enter all the payment info, or refresh the checkout_payment page, not ideal.

I'm assuming this could be solved by upgrading the Production API version on Square, but before I kill the store, I would like to ask which version of the Production API on Square I should upgrade to, based on the ZC/Square versions I currently have installed, and if I should also change my webhook endpoints to use this API version.

Thank you for the help!

29 Nov 2021, 5:46 PM
#651
mvstudio avatar

mvstudio

Zen Follower

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

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

mvstudio:

Hello.

There's what seems to be an unusual occurrence happening with this module. ZC version 1.5.6c, Square version 1.5.

Customers are complaining they cannot checkout, that the credit card module is "stuck on displaying an error" whenever wrong data is entered.

We tested entering an invalid CC number and it displays an error message, as it should. We then entered a valid CC number, all data correctly, but the previous error message continues to display not letting us move forward with checkout. The only way to remove the error message is to go back to checkout_shipping, go back again to checkout_payment and re-enter all the payment info, or refresh the checkout_payment page, not ideal.

I'm assuming this could be solved by upgrading the Production API version on Square, but before I kill the store, I would like to ask which version of the Production API on Square I should upgrade to, based on the ZC/Square versions I currently have installed, and if I should also change my webhook endpoints to use this API version.

Thank you for the help!

I went ahead and tested my theory and upgraded the Production API version to the latest one. I entered again the wrong CC data, error message displayed. Corrected the CC data, and error message continues on and is not letting me proceed with checkout.

Am I correct in assuming something else is going on? Has anyone reported this before? Thank you.

29 Nov 2021, 5:47 PM
#652
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,732
Plugin Contributions:
14

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

mvstudio:

Hello.

There's what seems to be an unusual occurrence happening with this module. ZC version 1.5.6c, Square version 1.5.

Customers are complaining they cannot checkout, that the credit card module is "stuck on displaying an error" whenever wrong data is entered.

We tested entering an invalid CC number and it displays an error message, as it should. We then entered a valid CC number, all data correctly, but the previous error message continues to display not letting us move forward with checkout. The only way to remove the error message is to go back to checkout_shipping, go back again to checkout_payment and re-enter all the payment info, or refresh the checkout_payment page, not ideal.

I'm assuming this could be solved by upgrading the Production API version on Square, but before I kill the store, I would like to ask which version of the Production API on Square I should upgrade to, based on the ZC/Square versions I currently have installed, and if I should also change my webhook endpoints to use this API version.

Thank you for the help!

I have corrected this by upgrading 1.56c client stores to the newest version of the Zen Square plugin and the newest API version in production with no further issues.

Be certain the old files are off the server as described in the install for the new Square plugin :)

[backup your site files and the db prior to making these changes just in case]

29 Nov 2021, 10:29 PM
#653
mvstudio avatar

mvstudio

Zen Follower

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

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

twitchtoo:

I have corrected this by upgrading 1.56c client stores to the newest version of the Zen Square plugin and the newest API version in production with no further issues.

Be certain the old files are off the server as described in the install for the new Square plugin :)

[backup your site files and the db prior to making these changes just in case]

Hi! Thanks for the reply.
I do have the latest version of the plugin and just today upgraded to the latest Square API, and it seems it didn't do much.
I'm afraid at this moment I cannot upgrade to the latest ZC version :( My store is heavily modified and I wouldn't be able to complete the upgrade in time for the holiday sales.
Is there anything I could patch for the time being to prevent this issue at least until the store is closed and I can upgrade everything?
Thanks so much!

29 Nov 2021, 11:49 PM
#654
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,732
Plugin Contributions:
14

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

First I would remove the module and check the db it has been removed properly Admin > Modules > Payment > Square... then remove the files and make sure they are not on the server... then reinstall everything.

Test the install.

Get errors again...
I would have to look at what is going wrong to see if there was a non generic tracer in the error log perhaps. Or force an error to see if there is an old reference on the server. Next I would try an older API version just in case the 'newest' one had a bug. And then start checking if the server version and PHP version mismatch along with the older PHP bridge these servers use is faulty.

You could post the error log get more eyes on it or hire that Twitchtoo guy to have a look - coffee is always a good place to start!
:cheers:

30 Nov 2021, 4:43 PM
#655
mvstudio avatar

mvstudio

Zen Follower

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

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

twitchtoo:

First I would remove the module and check the db it has been removed properly Admin > Modules > Payment > Square... then remove the files and make sure they are not on the server... then reinstall everything.

Test the install.

Get errors again...
I would have to look at what is going wrong to see if there was a non generic tracer in the error log perhaps. Or force an error to see if there is an old reference on the server. Next I would try an older API version just in case the 'newest' one had a bug. And then start checking if the server version and PHP version mismatch along with the older PHP bridge these servers use is faulty.

You could post the error log get more eyes on it or hire that Twitchtoo guy to have a look - coffee is always a good place to start!
:cheers:

Thank you for taking the time! So last night after business hours, I did as you suggested, and nothing changed. I deleted the module, reinstalled the module, I changed the API versions (went through each and everyone of them testing for errors along the way), nothing. Entering the wrong CC data triggers the error as it should, once the CC data is reentered correctly the error message is not removed, the customer cannot move forward with checkout. No log errors generated either. Refreshing the page is the only way to get rid of the error message generated however customers wouldn't know that and instead walked away. I've had months of abandoned shopping bags I had no idea about, until one customer finally brought it up a few days ago. And I was all these months wondering why my sales had tanked.

I will definitely upgrade ZC after the holiday season is over (heavily modified store https://www.byvalenti.com, so not an easy task to accomplish before Christmas :no:)

PHP Version on my server is 7.3.33, which should be ok for ZC1.5.6c.

The other thing that I can think of as a "patch" of sort, is to auto-refresh the page after the message is generated (?) I know I'm making you cringe right about now, I apologize about that. With my very limited knowledge of php, I've made quite a few here cringe over the years.

Can I invite you for coffee to take a look see if you could figure out a temporary solution? No emoji for coffee but this would do :cheers:

30 Nov 2021, 5:17 PM
#656
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,732
Plugin Contributions:
14

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

Agreed, it's not as cringy as it sounds lately... forcing the page to reload on error is a functional line of code that could be added and if I do spend time on it I may prove it should have had one anyways :)

30 Nov 2021, 6:48 PM
#657
mvstudio avatar

mvstudio

Zen Follower

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

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

twitchtoo:

Agreed, it's not as cringy as it sounds lately... forcing the page to reload on error is a functional line of code that could be added and if I do spend time on it I may prove it should have had one anyways :)

Ha! And here I thought my idea would be frowned upon! :D What would you need from me to get this patch sorted out?... Thanks!

11 Dec 2021, 11:49 AM
#658
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

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

Recent E-mail from square

We are making a change to how our OAuth service handles the redirect URL. Currently the redirect URL configured in the Developer Dashboard only needs to match a subset of the URL passed in the authorization request.

Current State Example

If the redirect URL in the Developer Dashboard is configured to: https://example.com/

And the redirect_uri parameter in the authorization request is: https://connect.squareup.com/oauth2/authorize?client_id=abcd-1234-zyxw&scope=PAYMENTS_READ&redirect_uri=https://example.com/oauth-redirect

Then the request succeeds because the first part of the redirect_uri parameter matches the configured redirect URL.

After February 14th, 2022, the redirect URL sent in the authorization request must exactly match the redirect URL in the Developer Dashboard or it will error.

Exact Match Example

If the redirect_uri parameter in the authorization request is:

https://connect.squareup.com/oauth2/authorize?client_id=abcd-1234-zyxw&scope=PAYMENTS_READ&redirect_uri=https://example.com/oauth-redirect

Then the redirect URl in the Developer Dashboard must be configured to:

https://example.com/oauth-redirect*************************

Assume as long as we have correctly set up our "Redirect URL" field on square, to https://your_store_url.com/square_handler.php including any subdirectories then all will be well.

11 Dec 2021, 2:06 PM
#659
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]

Interesting. Have a client who uses three URLs to redirect to their main site. One of them is supposedly getting nothing but declines from Square.

Looks like a little more investigating is in order.

13 Dec 2021, 2:25 AM
#660
todoonada avatar

todoonada

Zen Follower

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

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

brittainmark:

Recent E-mail from square


Assume as long as we have correctly set up our "Redirect URL" field on square, to https://your_store_url.com/square_handler.php including any subdirectories then all will be well.

The mail I received from Square reads differently. I wonder if anything has to be changed on Zen Cart code.

Current State Example
If the redirect URL in the Developer Dashboard is configured to: https://example.com/

And the redirect_uri parameter in the authorization request is: https://connect.squareup.com/oauth2/authorize?client_id=abcd-1234-zyxw&scope=PAYMENTS_READ&redirect_uri=https://example.com/oauth-redirect

Then the request succeeds because the first part of the redirect_uri parameter matches the configured redirect URL.

After February 14th, 2022, the redirect URL sent in the Authorization request must exactly match the redirect URL in the Developer Dashboard or it will error.

Exact Match Example
If the redirect_uri parameter in the authorization request is:
https://connect.squareup.com/oauth2/authorize?client_id=abcd-1234-zyxw&scope=PAYMENTS_READ&redirect_uri=https://example.com/oauth-redirect

Then the redirect URl in the Developer Dashboard must be configured to:
https://connect.squareup.com/oauth2/authorize?client_id=abcd-1234-zyxw&scope=PAYMENTS_READ&redirect_uri=https://example.com/oauth-redirect