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

Results 241 to 260 of 835
1 Dec 2018, 8:07 PM
#241
lat9 avatar

lat9

Administrator

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

Square Payment Module for Zen Cart [Support Thread]

lat9:

FWIW, I was able to correct the integration issue by editing the /includes/modules/pages/checkout_payment/jscript_square.php (it's also copied to the /checkout_one/jscript_square.php for the OPC integration) and changing:

if ($payment_modules->in_special_checkout()) {
return false;
}

> to
> ```
if ($payment_modules->in_special_checkout()[B] || (isset($payment_modules->paymentClass) && $payment_modules->paymentClass->code != 'square')[/B]) {
    return false;
}

The result is that Square's jQuery module doesn't load if the payment class is selected and it's not Square.
Please note, after additional thought, that's not going to work! The change needs to be made to the jQuery processing itself; otherwise, the payment method can't be changed to Square after a previous selection of a payment method.

Back to the drawing board ...

2 Dec 2018, 5:32 PM
#242
lat9 avatar

lat9

Administrator

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

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

I've submitted a change-request to the Zen Cart GitHub, see this commit for details of the proposed change.

2 Dec 2018, 6:05 PM
#243
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]

Cindy,
:smile:

I changed:

[TABLE="class: diff-table js-diff-table tab-size"]
[TR]
[TD="class: blob-code blob-code-deletion is-hovered"]Line 13: if ($payment_modules->in_special_checkout()) {

replaced:
if ($payment_modules->in_special_checkout() || empty($square) || !$square->enabled) {
[/TD]
 [/TR]
        [TR]
     [/TR]
[/TABLE]
  1. /includes/modules/pages/checkout_payment/jscript_square.php
  2. /includes/modules/pages/checkout_one/jscript_square.php

The download worked perfectly!!!

Mark,

2 Dec 2018, 7:51 PM
#244
lat9 avatar

lat9

Administrator

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

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

Thanks for the report, Mark. Turns out that the issue was raised when/if the Square payment method was zone-restricted as well; causing the jQuery error if the payment method was not enabled for the zone associated with the current billing address.

6 Dec 2018, 4:02 AM
#245
drbyte avatar

drbyte

Sensei

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

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

dbltoe:

All of a sudden, Square is bouncing with INVALID_ENUM_VALUE with the detail - "is not a valid enum value for 'billing_address.country' "

Is this something 0.95 might fix or do we need to come up with a country field to satisfy a new requirement.

[27-Nov-2018 17:04:48 UTC] Request URI: /index.php?main_page=checkout_process, IP address: 72.190.125.38
#1 trigger_error() called at [/home/spicdavi/public_html/includes/modules/payment/square.php:338]
#2 square->before_process() called at [/home/spicdavi/public_html/includes/classes/payment.php:245]
#3 payment->before_process() called at [/home/spicdavi/public_html/includes/modules/checkout_process.php:84]
#4 require(/home/spicdavi/public_html/includes/modules/checkout_process.php) called at [/home/spicdavi/public_html/includes/modules/pages/checkout_process/header_php.php:14]
#5 require(/home/spicdavi/public_html/includes/modules/pages/checkout_process/header_php.php) called at [/home/spicdavi/public_html/index.php:36]

[27-Nov-2018 17:04:48 UTC] PHP Notice: Square Connect [configuration] error.
Response Body:
stdClass Object
(
[errors] => Array
(
[0] => stdClass Object
(
[category] => INVALID_REQUEST_ERROR
```
=> INVALID_ENUM_VALUE

> [detail] => `` is not a valid enum value for `billing_address.country`.
> [field] => billing_address.country
> )
> 
> )
> 
> )
> 
> Response Headers:
> Array
> (
> [0] => HTTP/1.1 400 Bad Request
> [Content-Type] => application/json
> [Vary] => Origin, Accept-Encoding
> [X-Content-Type-Options] => nosniff
> [X-Download-Options] => noopen
> [X-Frame-Options] => SAMEORIGIN
> [X-Permitted-Cross-Domain-Policies] => none
> [X-Xss-Protection] => 1; mode=block
> [Date] => Tue, 27 Nov 2018 17:04:47 GMT
> [keep-alive] => timeout=60
> [Strict-Transport-Security] => max-age=631152000
> [content-length] => 182
> )
> in /home/spicdavi/public_html/includes/modules/payment/square.php on line 338

@dbltoe ... do you have any idea why the billing country is blank? It's obtained by lookup from the customer's default address, unless they change that address during checkout. The only reason I can think of why it would be blank is if they somehow were allowed to select a country which is not supported by your store, or if you've changed the "country name" or ISO codes in your Admin to something other than the default.
16 Dec 2018, 5:19 PM
#246
bobmarks avatar

bobmarks

New Zenner

Join Date:
Dec 2018
Location:
Alaska
Posts:
1
Plugin Contributions:
0

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

(Access Token needed) Still shows in red.

Everything is set correctly.

Everything (files) in correct location.

Yes I refreshed admin page 1 million times (not a million, but close)

Gots me baffled.

All latest versions installed.

Help, will give monatary compensation if this gets figured out.

It is on a Dreamhost server.

16 Dec 2018, 6:28 PM
#247
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]

It's generally that you need to take special care that ***all ***of the access token is removed and the entire access token is entered. The length of the token often makes you think you got it all when you didn't.

7 Jan 2019, 11:32 PM
#248
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]

**EDIT: Problem resolved
**
ZC 156 builtin Square setup
install on sandbox server with demo data
drop tables
import db from backup of live db
run zc_install

**RED: Access Token needed error
**
Seems that the setup is asking for input from our square account for which no field exists or I am not comprehending the field labels in setup.

Square setup.
Populate the fields as necessary.

There is NO Access token field in the zc square setup but there is one in our square account

Application ID copy/pasted from our Square account
Application Secret (OAUTH) copy/pasted from our square account


**EDIT: It helps if you read all the setup instructions. I missed the line where zc provided a link which needed to be pasted into our Square Account

Problem resolved.**

23 Feb 2019, 10:16 PM
#249
joeh avatar

joeh

New Zenner

Join Date:
Jan 2015
Location:
USA
Posts:
12
Plugin Contributions:
0

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

a new problem for me.
I get this error when testing

We could not initiate your transaction because of a problem with the card data you entered. Please correct the card data, or report this error to the Store Owner: SQ-NONCE-FAILURE

All the credit card info is correct (used 3 different cards

23 Feb 2019, 11:03 PM
#250
drbyte avatar

drbyte

Sensei

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

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

SQ-NONCE-FAILURE happens when the javascript on the page is unable to properly obtain a payment token from Square. This is almost always because there are javascript errors on your page. Javascript errors are common when mixing multiple plugins or adding extra things to the template. You'll need to investigate the errors in your template.

24 Feb 2019, 4:16 AM
#251
joeh avatar

joeh

New Zenner

Join Date:
Jan 2015
Location:
USA
Posts:
12
Plugin Contributions:
0

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

how do I do that?

24 Feb 2019, 3:14 PM
#252
lat9 avatar

lat9

Administrator

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

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

Use your browser's "Developer Tools" (for FireFox and Chrome, that's opened by pressing the F12 key if running on Windows). That will open up (by default) additional information in the bottom portion of your display.

Click on the ***Console ***tab and you'll see various messages associated with files' loading and javascript/jQuery information and (most importantly) errors. That should allow you to hone in on the culprit.

26 Feb 2019, 2:44 PM
#253
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,278
Plugin Contributions:
37

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

DrByte:

Undecided. What's the business reason behind the request? (it helps for understanding the scope)

Some people prefer less worries about the PCI security parts.

I have an issue maybe you can provide some insight. This is a clone outdoorcountrydecor com, the other is working fine. There are no errors and they reside on the same server. Zen 1.5.5F, PHP 7.1.26, Square 0.96.

I cannot get Oauth to confirm. The cloned site is in the same Square account, as well as 3 others working fine with their own location IDs, same as this one.

HTTPS is fine, couldn't locate any JS errors, zero logs being produced, uninstalled & reinstalled, re-uploaded module files & again un-re-installed, created a new ap and swapped out the numbers, changes the Oauth token manually, redirect url is correct.... nothing, you push green button to authorize, takes you to square, login, back to the site with url paramenters... stalls, never finishes or completes. Refreshs do nothing either.

~Melanie

27 Feb 2019, 12:00 AM
#254
jewelm avatar

jewelm

New Zenner

Join Date:
Apr 2015
Posts:
4
Plugin Contributions:
0

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

I was wondering if someone might be able to help me out with the square module (v.96) not redirecting correctly and not authorizing. I updated my site and did a clean install (currently using v1.5.5f) and the module is no longer working. Before doing a fresh install it was working just fine. Since I've never had this issue I'm not sure how to go about finding a solution. I looked on the forums and didn't see any posts on a similar topic. I could have over looked it, and if I did I do apologize.

What is happening is when I click the green authorize button it loads the square login page, I log in and taken to blank page with no message. If I try refreshing the admin page it still shows (Access Token needed).

Both my application ID and OAuth are correct and the redirect link is set to https://mysite.com/square_handler.php (which the file is in the root directory).

The only difference is before doing a fresh install I worked on and designed the new site in a test directory before transferring it to the root directory.

If anyone has any advice or can point me in the right direction to fix this issue I would be very appreciative.

Thanks,
Steve

27 Feb 2019, 12:21 AM
#255
drbyte avatar

drbyte

Sensei

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

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

@mprough and @jewelm,

You can do some basic debugging by editing line 11 of the square_handler.php and setting false to true.

@jewelm, Are you sure you brought the square.handler.php file over from test to production? Square needs to be told the correct URL and of course the file needs to exist.
What happens when you go to https://your_site.com/square_handler.php ? (yes, HTTPS) Normally you want to just see a white page. But if you're getting an error (ie: 404-not-found, etc) then you'll need to fix that, cuz Square will also see the error and thus will fail.

After setting $verbose=true like I mentioned above, visiting the square_handler.php with your browser should give you some text about the current token status according to your store. You can use that for troubleshooting.

27 Feb 2019, 12:39 AM
#256
jewelm avatar

jewelm

New Zenner

Join Date:
Apr 2015
Posts:
4
Plugin Contributions:
0

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

Oh wow thank you for the quick reply DrByte. Yeah everything was transferred over correctly (other than this, everything is working just fine) The configure files have also been updated.

If I load the square_handler.php page it does load to a blank page. No errors.

I've just been trying to narrow down things to figure where to look and while in the square app if I change the redirect url from https://mysite.com/square_handler.php to just https://mysite.com then the redirect does work. (using admin>payments>square>click green authorize button>login>redirected to site homepage).

Does this indicate an issue with the square_handler.php file itself?

Thanks again.

Edit: Changing the redirect url was just a test to see if logging into square would work and trigger the redirect. I know it wouldn't be able to authorize or get the access token to get the module to run.

27 Feb 2019, 1:58 PM
#257
jewelm avatar

jewelm

New Zenner

Join Date:
Apr 2015
Posts:
4
Plugin Contributions:
0

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

An Update to my previous post. This evening I spent some time trying to figure it out and haven't come up with any solutions. I ended up installing a default zen cart (no custom templates or extra plugins) v1.5.5f into a new directory (/dev) and the same issue happened.

The redirect blank screen and url I am seeing after logging in from clicking the green authorize button is:

https://mysite.com/dev/square_handler.php?code= (an OAuth that is different than mine that changes with each attempt) &state= (set of random numbers that also change after each attempt)#=

Not sure if that is any indication, but that is where I am at currently.

As stated earlier everything was working just fine a few days ago. I wanted to clean up the sites back end and database. So I created a test directory, installed a clean v1.5.5f and new database. Installed all the plugins and template I use, got it back up in running and transferred it to the root directory. The only thing I did not set up was the payment modules, which is just paypal and square, until the updated site was on the root directory. Paypal set up just fine and payments process during checkout.

Nothing was changed on my host or in my square account. I did try creating a new square app, but same issue and url happened.

-Steve

27 Feb 2019, 2:44 PM
#258
mprough avatar

mprough

Totally Zenned

Join Date:
Nov 2007
Location:
Woodbine, Georgia, United States
Posts:
4,278
Plugin Contributions:
37

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

I can confirm with Jewelm of this also for myself

https://mysite.com/dev/square_handler.php?code= (an OAuth that is different than mine that changes with each attempt) &state= (set of random numbers that also change after each attempt)#=

@DrByte this

You can do some basic debugging by editing line 11 of the square_handler.php and setting false to true.
whether authorizing or simply loading the page in my browser simply says failure

28 Feb 2019, 12:58 AM
#259
radiowave911 avatar

radiowave911

New Zenner

Join Date:
Jul 2015
Location:
Pennsylvania, United States
Posts:
11
Plugin Contributions:
0

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

I am also having issues getting the module set up. I have verified the Application ID, and Application Secret (Oauth) values match what is configured in the app on my Square account. I have also verified the Oauth Redirect URL is correct.

When I click the green button to get the token, I am taken to my square account login page. After entering my credentials, I receive an HTTP 417 error, which is an 'Expectation failed' error, which indicates that the expectation in the Expect header of the web request could not be met.

I enabled the additional messages ($verbose = true) and get the message 'failure'.

While attempting to troubleshoot, I disabled the .htaccess file for this site, which only contained rewrite rules to prevent site image scraping (still currently disabled).

I am running Zen Cart 1.5.6a, Database patch level 1.5.6, PHP 5.6.40 (I plan to move this to 7 as soon as I can - there are other dependencies on my hosting account that presently prevent this), MySQL 5.5.5-10.1.38-MariaDB, Square Payments Module 0.96.

I am open to any suggestions to get this working, and will provide any additional information as necessary (and appropriate, of course).

28 Feb 2019, 4:15 PM
#260
cacoeman avatar

cacoeman

New Zenner

Join Date:
Feb 2019
Location:
Midwest USA
Posts:
3
Plugin Contributions:
0

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

radiowave911:

I am also having issues getting the module set up. I have verified the Application ID, and Application Secret (Oauth) values match what is configured in the app on my Square account. I have also verified the Oauth Redirect URL is correct.

When I click the green button to get the token, I am taken to my square account login page. After entering my credentials, I receive an HTTP 417 error, which is an 'Expectation failed' error, which indicates that the expectation in the Expect header of the web request could not be met.

I enabled the additional messages ($verbose = true) and get the message 'failure'.

While attempting to troubleshoot, I disabled the .htaccess file for this site, which only contained rewrite rules to prevent site image scraping (still currently disabled).

I am running Zen Cart 1.5.6a, Database patch level 1.5.6, PHP 5.6.40 (I plan to move this to 7 as soon as I can - there are other dependencies on my hosting account that presently prevent this), MySQL 5.5.5-10.1.38-MariaDB, Square Payments Module 0.96.

I am open to any suggestions to get this working, and will provide any additional information as necessary (and appropriate, of course).

I am getting the exact same issue as stated above, my square_handler appends the following code after the .php (square_handler.php?code=sq0cgp-j_F4unDPtGZ02XK5gVKs1Q&state=5c7806a1d350a#=) None of that extra stuff is my account creds. I changed to True as well on thatsquare_handler.php file and the word failure is all that shows up, as mentioned by radiowave above. Running 1.5.6a - Square 0.96 - PHP version: 5.6.30 - Server version: 5.7.25 - MySQL Community Server (GPL).