-
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
how do you know i'm not already doing that? ...
That's good to hear - the customers in question are not exactly tech savvy and couldn't report on their experience.
I'm not positive what $error->getCode() is going to return - can we look for this particular message and say something like "try another card?"
-
Re: Square WebPay support thread.
one other detail when the url to the square handler is output, it no longer contains https according to this server. Can I assume this was the first problem? I checked square to make sure I had entered it with https and I did for sure.
I deleted and uploaded the mod again - looks like there was a problem with the upload before but now more sure of all files.
New error:
[11-Jul-2022 12:27:31 America/Chicago] PHP Fatal error: Uncaught Error: Class 'Square\Apis\OAuthApi' not found in /includes/modules/payment/square_webPay/square/square/src/SquareClient.php:327
Stack trace:
#0 /includes/modules/payment/square_webPay.php(699): Square\SquareClient->getOAuthApi()
#1 /squareWebPay_handler.php(33): square_webPay->exchangeForToken('sq0cgp-yqknT5yc...')
#2 {main}
thrown in /includes/modules/payment/square_webPay/square/square/src/SquareClient.php on line 327
[11-Jul-2022 12:27:31 America/Chicago] Request URI: /squareWebPay_handler.php?code=sq0cgp-yqknT5ycT7STIC6TiIdI7g&response_type=code&state=365182f3272e192f5b9fee7f9f0c3343 0, IP address: 76.179.90.49
--> PHP Fatal error: Uncaught Error: Class 'Square\Apis\OAuthApi' not found in /includes/modules/payment/square_webPay/square/square/src/SquareClient.php:327
Stack trace:
#0 /includes/modules/payment/square_webPay.php(699): Square\SquareClient->getOAuthApi()
#1 /squareWebPay_handler.php(33): square_webPay->exchangeForToken('sq0cgp-yqknT5yc...')
#2 {main}
thrown in /includes/modules/payment/square_webPay/square/square/src/SquareClient.php on line 327.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
swguy
That's good to hear - the customers in question are not exactly tech savvy and couldn't report on their experience.
I'm not positive what $error->getCode() is going to return - can we look for this particular message and say something like "try another card?"
can you please email the full log that you are getting?
i'm not really into giving generic error messages when we should have the exact detail of what went wrong.
that said, it is entirely possible that i am not providing that detailed message and that getCode and getDetail is not what i expect it to be.
i certainly am willing to add some notifiers so that you can override the message that goes to the messageStack is that works for you.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
swguy
@carlwhat is maintaining the Square plugin; please don't post information about your fork - it's disrespectful and confusing to new people.
I will immediately delete such posts.
so should I go back and delete/overwrite again with the original plugin file? I downloaded that fork.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
delia
so should I go back and delete/overwrite again with the original plugin file? I downloaded that fork.
delia,
i would re-download it either from the plugins here. or from the source which is here:
https://github.com/proseLA/square_we...ses/tag/v1.0.1
i would review the data here:
https://docs.zen-cart.com/user/payme...-payments-form
at some point i plan on redoing this handshake with the OAuth token. which is what the handler does. i personally find it problematic as well... i tried modeling it after the original square module, and now i am not really liking it. i had to get a new OAuth token myself the other day, and it took me forever! i think mostly because of the production v sandbox environment.
unfortunately i can not provide much help. but the idea that you have missing classes suggests to me you have not uploaded all of the code. on my install it finds it finds those classes no problem.
perhaps someone else can chime on getting the OAuth token.
best.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
swguy
That's good to hear - the customers in question are not exactly tech savvy and couldn't report on their experience.
I'm not positive what $error->getCode() is going to return - can we look for this particular message and say something like "try another card?"
ok, i have simulated a few errors. the details provided on this page:
https://developer.squareup.com/refer...nums/ErrorCode
are not available in the response.
in addition, it seems that the getDetail provides all of the information in the getCode method. so having both of those in the message could look confusing.
i will look into providing a config option so that a generic message could be chosen rather the specific message as opposed to doing a notifier. and then you can have a choice. hope that works for you.
when an error comes up here is what one can present back to the customer:
https://www.dropbox.com/s/vrh971v5ui...thods.png?dl=0
best.
-
Re: Square WebPay support thread.
whatever went wrong - I now have it working fine. That was the craziest crap I've ever run into. working between 2 different ftp programs and 2 different OS and weirdness and more weirdness. I'm thinking some caching was the issue somewhere.....
-
Re: Square WebPay support thread.
When this happens:
Your transaction failed due to an error: (access token expired) The provided OAuth access token has expired. You must renew the access token via the Renew Access Toke via the Renew Access Token Endpoint.
Can you detect it and email the store owner?
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
delia
whatever went wrong - I now have it working fine. That was the craziest crap I've ever run into. working between 2 different ftp programs and 2 different OS and weirdness and more weirdness. I'm thinking some caching was the issue somewhere.....
:thumbsup:
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
swguy
When this happens:
Your transaction failed due to an error: (access token expired) The provided OAuth access token has expired. You must renew the access token via the Renew Access Toke via the Renew Access Token Endpoint.
Can you detect it and email the store owner?
you are very demanding....
-
Re: Square WebPay support thread.
Yikes.
[12-Jul-2022 17:30:21 America/Chicago] PHP Fatal error: Uncaught TypeError: Argument 1 passed to square_webPay::saveAccessToken() must be an instance of Square\Models\ObtainTokenResponse, array given, called in /home/ccs/public_html/zen/includes/modules/payment/square_webPay.php on line 732 and defined in /home/ccs/public_html/zen/includes/modules/payment/square_webPay.php:644
Can't even see Webpay in the sidebar.
-
Re: Square WebPay support thread.
Resolution:
Edit URL in browser address bar to end in
action=delete
Then you can remove the module and add again.
-
Re: Square WebPay support thread.
I think the root cause was that I said disable the old OAuth secret right away (instead of waiting 24 hours as is done by default). So it may be best not to do that.
-
Re: Square WebPay support thread.
Not an issue, just an uncaught error for information. I think either my serves DNS was down or the square website was down. Log file below.
[13-Jul-2022 00:01:19 UTC] PHP Notice: Exception when calling OAuthApi->obtainToken: Could not resolve host: connect.squareup.com in /includes/modules/payment/square_webPay.php on line 733
[13-Jul-2022 00:01:19 UTC] PHP Fatal error: Uncaught Exception: Error Processing Request: Token renewal failed! in /includes/modules/payment/square_webPay.php:734
Stack trace:
#0 /includes/modules/payment/square_webPay.php(592): square_webPay->renewOAuthToken()
#1 /squareWebPay_handler.php(45): square_webPay->token_refresh_check()
#2 {main}
thrown in /includes/modules/payment/square_webPay.php on line 734
[13-Jul-2022 00:01:19 UTC] Request URI: , IP address: .
--> PHP Fatal error: Uncaught Exception: Error Processing Request: Token renewal failed! in /includes/modules/payment/square_webPay.php:734
Stack trace:
#0 /includes/modules/payment/square_webPay.php(592): square_webPay->renewOAuthToken()
#1 /squareWebPay_handler.php(45): square_webPay->token_refresh_check()
#2 {main}
thrown in /includes/modules/payment/square_webPay.php on line 734.
The token had not expired, I just have a cron job to renew it. I just went into admin>payments>squarewebpay and edited settings and updated with out making any changes. This renewed the access token.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
brittainmark
Not an issue, just an uncaught error for information. I think either my serves DNS was down or the square website was down. Log file below.
[13-Jul-2022 00:01:19 UTC] PHP Notice: Exception when calling OAuthApi->obtainToken: Could not resolve host: connect.squareup.com in /includes/modules/payment/square_webPay.php on line 733
[13-Jul-2022 00:01:19 UTC] PHP Fatal error: Uncaught Exception: Error Processing Request: Token renewal failed! in /includes/modules/payment/square_webPay.php:734
Stack trace:
#0 /includes/modules/payment/square_webPay.php(592): square_webPay->renewOAuthToken()
#1 /squareWebPay_handler.php(45): square_webPay->token_refresh_check()
#2 {main}
thrown in /includes/modules/payment/square_webPay.php on line 734
[13-Jul-2022 00:01:19 UTC] Request URI: , IP address: .
--> PHP Fatal error: Uncaught Exception: Error Processing Request: Token renewal failed! in /includes/modules/payment/square_webPay.php:734
Stack trace:
#0 /includes/modules/payment/square_webPay.php(592): square_webPay->renewOAuthToken()
#1 /squareWebPay_handler.php(45): square_webPay->token_refresh_check()
#2 {main}
thrown in /includes/modules/payment/square_webPay.php on line 734.
The token had not expired, I just have a cron job to renew it. I just went into admin>payments>squarewebpay and edited settings and updated with out making any changes. This renewed the access token.
i'm guessing your DNS was down.
perhaps i do not need to throw the exception. current code is:
PHP Code:
} catch (Exception $e) {
trigger_error('Exception when calling OAuthApi->obtainToken: ' . $e->getMessage());
throw new Exception('Error Processing Request: Token renewal failed!', 1);
}
i will think and play around a bit.
thanks for the report!
-
Re: Square WebPay support thread.
for those of you who have helped me with debugging problems, i want to express my thanks.
for those of you who attempted to brow beat me into submission, i say bugger off!
if you do not know which group you are in, feel free to DM me.
for those of you still having problems with OPC and square_webPay, i want to refer you to this post, and specifically this github issue which will be corrected in the soon to be released version of OPC.
no change is necessary for square_webPay to play nice with OPC.
individuals who i privately contacted about testing, please change this file:
https://github.com/lat9/one_page_che...heckout_one.js
and it's minimized version:
https://github.com/lat9/one_page_che...out_one.min.js
to the released version; once released.
while your testing confirmed all of my debugging, keeping everyone on the released version of OPC is better for support in the long run.
other cleanup of square_webPay (including better handling of the OAuth handshake) may happen in the future. development does not happen without support.
best.
-
Re: Square WebPay support thread.
> if you do not know which group you are in, feel free to DM me.
So old school. Clearly you should build a Wiki or something so an asynchronous determination can be made.
-
Re: Square WebPay support thread.
I am aware of which group I am in...
-
Re: Square WebPay support thread.
Yeah but, I'm in all three. :cheers:
-
Re: Square WebPay support thread.
1.5.7d PHP 7.4.3
Site is running the latest Github versions of WebPay and OPC.
Single files previously changed in OPC were overwritten as instructed.
This has shown up three times during a time span when 47 successful WebPay captures were made.
Code:
[18-Jul-2022 10:22:43 America/New_York] PHP Notice: missing token result: check if card button is disabled on dev console using: document.getElementById('card-button'); else look for javascript error in console. in /includes/modules/payment/square_webPay.php on line 239
Still cannot duplicate and all transactions I try show no console errors.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
Quote:
Originally Posted by
dbltoe
1.5.7d PHP 7.4.3
Site is running the latest Github versions of WebPay and OPC.
Single files previously changed in OPC were overwritten as instructed.
This has shown up three times during a time span when 47 successful WebPay captures were made.
Code:
[18-Jul-2022 10:22:43 America/New_York] PHP Notice: missing token result: check if card button is disabled on dev console using: document.getElementById('card-button'); else look for javascript error in console. in /includes/modules/payment/square_webPay.php on line 239
Still cannot duplicate and all transactions I try show no console errors.
please reread my instructions above.
no change is necessary to the latest released version of OPC.
this file should run without problem as testing has been done:
https://github.com/lat9/one_page_che...heckout_one.js
its minimized version should work as well (i am not a fan of minimized versions, especially when code is sporadically spewing errors):
https://github.com/lat9/one_page_che...out_one.min.js
i have seen you reporting issues with OPC. again, this problem is an OPC problem, not a square_webPay (SWP) problem.
OPC (with comments) has over 1000 lines of javascript. SWP (with comments) has under 200 lines of javascript.
no one using the standard checkout reports problems with SWP. with OPC, there are a few...
but again, i am reasonably confident that I have found the root of this problem, and that it has been addressed in the OPC code.
i am not 100% confident that you are running the latest version of said code. and especially given that you have modified it which should no longer be needed.
-
Re: Square WebPay support thread.
As you may recall, I was part of that troubleshooting.
And, just for clarification, most of today's reputable FTP programs, when told to overwrite, will do just that.
Again, both OPC and WebPay are loaded with their current GitHub versions.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
dbltoe
And, just for clarification, most of today's reputable FTP programs, when told to overwrite, will do just that.
Good to know...:smartalec:
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
for those of you who have helped me with debugging problems, i want to express
my thanks.
for those of you who attempted to brow beat me into submission, i say
bugger off!
if you do not know which group you are in, feel free to DM me.
for those of you still having problems with OPC and square_webPay, i want to refer you to
this post, and specifically
this github issue which will be corrected in the soon to be released version of OPC.
no change is necessary for square_webPay to play nice with OPC.
individuals who i privately contacted about testing, please change this file:
https://github.com/lat9/one_page_che...heckout_one.js
and it's minimized version:
https://github.com/lat9/one_page_che...out_one.min.js
to the released version; once released.
while your testing confirmed all of my debugging, keeping everyone on the released version of OPC is better for support in the long run.
other cleanup of square_webPay (including better handling of the OAuth handshake) may happen in the future. development does not happen without support.
best.
Does this correct the problem with the radio button?
I have upgraded OPC and I am still getting the same issue
-
Re: Square WebPay support thread.
I have just had this email through from Square:
Hi there,
We wanted to inform you that the SqPaymentForm JavaScript library retirement has been extended to 2022-10-31 and its functionality will be shut off after this date. Additionally new applications will not be allowed to use SqPaymentForm from 2022-07-21.
SqPaymentForm has been deprecated since 2021-05-13 and replaced by Web Payments SDK. We encourage you to migrate as soon as possible by following this step-by-step migration guide.
Check out the Web Payments SDK documentation and technical reference to get started today.
If you have any questions, drop us a note in our Developer Forums.
Thank you,
The Square Developer Team
--------------------------------------------------
This means that the old Square Module should work until 31st October 2022. So it gives the developers of Square WebPay and OPC time to correct any bugs between the functionality of the two modules from either side of the fence. Hopefully this means there can be a little less stress around the timescales of getting bugs resolved, and we will then get a NEW Square WebPay Module that works happily across the standard Zen Cart Checkout AND One Page Checkout.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
Nick1973
I have just had this email through from Square:
Hi there,
We wanted to inform you that the SqPaymentForm JavaScript library retirement has been extended to 2022-10-31 and its functionality will be shut off after this date. Additionally new applications will not be allowed to use SqPaymentForm from 2022-07-21.
SqPaymentForm has been deprecated since 2021-05-13 and replaced by Web Payments SDK. We encourage you to migrate as soon as possible by following this step-by-step migration guide.
Check out the Web Payments SDK documentation and technical reference to get started today.
If you have any questions, drop us a note in our Developer Forums.
Thank you,
The Square Developer Team
--------------------------------------------------
This means that the old Square Module should work until 31st October 2022. So it gives the developers of Square WebPay and OPC time to correct any bugs between the functionality of the two modules from either side of the fence. Hopefully this means there can be a little less stress around the timescales of getting bugs resolved, and we will then get a NEW Square WebPay Module that works happily across the standard Zen Cart Checkout AND One Page Checkout.
I will add, I am still having token problems with the latest Square WebPay and OPC despite trying the various downloads from GitHub and from Modules. I have tried all the various fixes which are supposed to work, but unfortunately don't or they don't appear to. If there is fix for the radio button issue, I do not have it and have not been able to find it. This issue arises when a customer enters their Credit Card Details before selecting the Credit Card Radio Button at the checkout. The payment is not taken and it results in a 'TOKEN' error. However, it only happens when using One Page Checkout, and NOT the standard Zen Cart Checkout. This is why I have now resorted back to the OLD Square Module, until BOTH modules have this fixed.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
Nick1973
I will add, I am still having token problems with the latest Square WebPay and OPC despite trying the various downloads from GitHub and from Modules. I have tried all the various fixes which are supposed to work, but unfortunately don't or they don't appear to. If there is fix for the radio button issue, I do not have it and have not been able to find it. This issue arises when a customer enters their Credit Card Details before selecting the Credit Card Radio Button at the checkout. The payment is not taken and it results in a 'TOKEN' error. However, it only happens when using One Page Checkout, and NOT the standard Zen Cart Checkout. This is why I have now resorted back to the OLD Square Module, until BOTH modules have this fixed.
This is probably of no help to you but further to the debugging I carried out on Github I have double-checked the fix that was provided with the customer interaction you describe above.
ZC v1.5.7d
OPC v2.4.1
PayPal EC
Square WebPay v1.0.1
Using the revised version of jquery.checkout_one.js as outlined in this Github issue (this revised file is now in OPC v2.4.2), I continue to not get the 'TOKEN' error.
I have yet to upgrade my live site to OPC v2.4.2 (other than the revised .js file), once I do I will obviously check again and report if the issue raises it's ugly head again.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
simon1066
This is probably of no help to you but further to the debugging I carried out on Github I have double-checked the fix that was provided with the customer interaction you describe above.
ZC v1.5.7d
OPC v2.4.1
PayPal EC
Square WebPay v1.0.1
Using the revised version of jquery.checkout_one.js as outlined in this
Github issue (this revised file is now in OPC v2.4.2), I continue to
not get the 'TOKEN' error.
I have yet to upgrade my live site to OPC v2.4.2 (other than the revised .js file), once I do I will obviously check again and report if the issue raises it's ugly head again.
Ok I will obviously hang on until I delete OPC and SquareWebPay to try again. Are you using Bootstrap?
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
Nick1973
Ok I will obviously hang on until I delete OPC and SquareWebPay to try again. Are you using Bootstrap?
I am not using a Bootstrap template. I guess if you are concerned about that then switching to a Classic termplate might help.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
simon1066
I am not using a Bootstrap template. I guess if you are concerned about that then switching to a Classic termplate might help.
Not an option really due to all the work involved in recreating the whole thing from scratch. I'd lose alot of optimisation work and it would literally screw my business even further.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
Nick1973
Not an option really due to all the work involved in recreating the whole thing from scratch. I'd lose alot of optimisation work and it would literally screw my business even further.
I guess I was thinking that switching templates temporarily might help establish if it's your template that's causing the issue - presumably it's ZCA Bootstrap Template for One-Page Checkout. I don't know enough about that template to know if it might be a thing.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
simon1066
I guess I was thinking that switching templates temporarily might help establish if it's your template that's causing the issue - presumably it's ZCA Bootstrap Template for One-Page Checkout. I don't know enough about that template to know if it might be a thing.
I have a client that is using Responsive Classic and he is also getting the issue when OPC is enabled.
-
Re: Square WebPay support thread.
Zen Cart 1.5.7d
Database Patch Level: 1.5.7b
Clone A Template: Responsive clone
Sitemap XML v4.0
PayPal Express Checkout (Debug)
Square WebPay 1.0.0
I got a debug log:
Code:
[26-Jul-2022 11:03:06 America/Chicago] PHP Notice: missing token result: {"main_page":"checkout_confirmation","securityToken":"75f23328f7c105dabb0dd6620335df67","action":"submit","payment":"square_webPay","comments":"","x":"42","y":"18"} in /includes/modules/payment/square_webPay.php on line 234
I logged into my Square account and realized maybe I forgot to renew my token because there was a notice that my API version was two (2) behind. Changed API version to latest and replaced token.
Today I got a debug log:
Code:
[30-Jul-2022 07:10:14 America/Chicago] Request URI: /VDSstore/ADMIN/index.php?cmd=modules&set=payment&module=square_webPay&action=edit, IP address: 152.97.210.26
#1 square_webPay->getLocationsPulldownArray() called at [/home/vinyld6/public_html/VDSstore/includes/modules/payment/square_webPay.php:1405]
#2 zen_cfg_pull_down_squareWebPay_locations() called at [/home/vinyld6/public_html/VDSstore/ADMIN/modules.php(335) : eval()'d code:1]
#3 eval() called at [/home/vinyld6/public_html/VDSstore/ADMIN/modules.php:335]
#4 require(/home/vinyld6/public_html/VDSstore/ADMIN/modules.php) called at [/home/vinyld6/public_html/VDSstore/ADMIN/index.php:11]
--> PHP Warning: Invalid argument supplied for foreach() in /home/vinyld6/public_html/VDSstore/includes/modules/payment/square_webPay.php on line 794.
I also received a square alert:
Code:
Jul-30-2022 04:15:44
Error Dump: [UNAUTHORIZED]: The `Authorization` http header of your request was incorrect or expired. The header value is expected to be of the format "Bearer TOKEN" (without quotation marks), where TOKEN is a valid access token (e.g. "Bearer ABC123def456GHI789jkl0"). For more information, see https://developer.squareup.com/docs/build-basics/using-rest-api#__set-the-headers__ ....
Most of my sales are paid via PayPal. I have been renewing my Square token manually every 10 days via my Square account. It worked 07/03/2022 just a few orders ago. It seems there something else I need to be doing to get square payments to come through with the new API version, like setting the headers.
I'm just not sure how or where to do this. Can someone offer me a little guidance where I can find the header to change the API version? Should I go back to my previous API version through Square? Could I have just forgotten to checkbox the "Change my webhook endpoints to use this API version" while in Square? When done, what would be the recommended way to check that all is working?
TIA
-
Re: Square WebPay support thread.
I've followed swguy link and replaced my OAuth Application Secret as per: https://www.zen-cart.com/showthread....en-has-expired
to: https://docs.zen-cart.com//user/payment/square_errors/
Thank you Scott!
Now we wait.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
VDecalS
Today I got a debug log:
Code:
[30-Jul-2022 07:10:14 America/Chicago] Request URI: /VDSstore/ADMIN/index.php?cmd=modules&set=payment&module=square_webPay&action=edit, IP address: 152.97.210.26
#1 square_webPay->getLocationsPulldownArray() called at [/home/vinyld6/public_html/VDSstore/includes/modules/payment/square_webPay.php:1405]
#2 zen_cfg_pull_down_squareWebPay_locations() called at [/home/vinyld6/public_html/VDSstore/ADMIN/modules.php(335) : eval()'d code:1]
#3 eval() called at [/home/vinyld6/public_html/VDSstore/ADMIN/modules.php:335]
#4 require(/home/vinyld6/public_html/VDSstore/ADMIN/modules.php) called at [/home/vinyld6/public_html/VDSstore/ADMIN/index.php:11]
--> PHP Warning: Invalid argument supplied for foreach() in /home/vinyld6/public_html/VDSstore/includes/modules/payment/square_webPay.php on line 794.
hi @VDecalS,
from what i remember you have a sessions issue that prevents the automatic renewal of the OAuth token. that issue was well documented here:
https://www.zen-cart.com/showthread....ted%20behavior.
so i am not sure if that part of your equation was eventually resolved. because of that problem, you have to manually renew your OAuth token; as we changed your handler (if my memory serves me correctly).
in addition, looking at this log file, you have quoted, foreach and line 794 is version 1.0.0. i would update to 1.0.1, with the exception of the handler file.
i think @swguy's solution is a bit of a hack; but if it works, i think it is fine for now.
i have plans to do some refactoring and updating of the module, and specifically with the handling of production v sandbox environments as well as the renewal of the tokens. unfortunately i'm currently a little strapped for time and perhaps a bit un-motivated. but we will see....
glad you were able to get it working!
-
Re: Square WebPay support thread.
Hi carlwhat,
I've gotten a new order with cc payment, so everything is working now. Manually renewing my OAuth token is working for me. Updating the API version was simple enough. Updating/replacing the OAuth secret to match the new API version just skipped my train of thinking. This make complete sense to me now that I've experienced the result.
Thanks for the query. :hug:
-
Re: Square WebPay support thread.
> i think @swguy's solution is a bit of a hack; but if it works, i think it is fine for now.
@dbltoe and @carlwhat:
If there's an easier way, please write it up so I can add it to the documentation.
-
Re: Square WebPay support thread.
Hi Scott,
I didn't see it as a hack.
I think the only clarification to the instructions: https://docs.zen-cart.com//user/payment/square_errors/
would be a step 5: Save
Everything after that is only necessary if you get the blank screen. Perhaps that portion of the remaining instructions should be boxed or indented or ?. Though I didn't have a problem understanding the instructions, others might.
Your post helped me get to an understanding of the process. - Thanks!
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
swguy
@dbltoe and @carlwhat:
If there's an easier way, please write it up so I can add it to the documentation.
As I stated on GitHub, I have no knowledge of the process with WebPay as I have not had a token expire. We did ours different under the original Square but I am not privy to any of the steps for WebPay.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
i think @swguy's solution is a bit of a hack; but if it works, i think it is fine for now.
i have plans to do some refactoring and updating of the module, and specifically with the handling of production v sandbox environments as well as the renewal of the tokens. unfortunately i'm currently a little strapped for time and perhaps a bit un-motivated. but we will see....
hi @swguy,
i have looked at what you wrote up and i think it is fine. when i initially read it, i thought one was removing files and then re-uploading them.
the bigger issue to me is a more elegant way of handling this situation with the code. which is why i think a refactor may be in order...
but i think (and appreciate) you documenting this situation and the way to address it. and in further examining it, i think it covers the situation well. in addition, the term, hack, was poorly chosen on my part.
hopefully, i will get some time and make this situation a little cleaner. again, i was initially following the old square module code, as opposed to re-thinking about, perhaps a better way to handle the renewals of the OAuth.
i will now add that to my async wiki....
best.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
dbltoe
Those of you who were
already using Square prior to carlwhat's update to WebPay may want to check your ADMIN >> Customers >> Orders for orders made in late March or earlier that have
square under the Payment/Shipping header versus
square_webPay.
We (myzencarthostDOTcom) updated several of our customers while some did 1.0.0 and 1.0.1 on their own. Both groups have shown cases where the Payment/Shipping was not changed to
square_webPay on orders made with the old square.
If you are using WebPay and the Payment/Shipping shows
square, you will not be able to access the full details for the order. IOW, you will not see anything AFTER the payment method. A partial blank screen with no log created and no way to see comments on the order.
NOTE: Some sites with Edit Orders are able to access the data with that mod. Still, the fix needs to be made.
Somehow, the upgrades did not modify the orders table in the database for any existing
square orders. Specifically, the payment_module_code field. Some sites had a DB prefix and others did not so, I don't think that's the problem.
There's a quick fix if you find this happening. Go to ADMIN >> Tools >> Install SQL Patcches (it shows up as SQL Query Executor on the page).
Please read the instructions on that page that are in RED.
Enter the following code.
Code:
UPDATE orders
SET payment_module_code = 'square_webPay'
WHERE payment_module_code = 'square';
Then click on send.
You'll be good to go
Is this still the method to fix the order details not showing up? Tried it and doesn't work.
-
Re: Square WebPay support thread.
solved. had to login and set the credentials for oauth again for it to work.
-
Re: Square WebPay support thread.
So why does the token expire even when there have been multiple orders processed in the last week?
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
barco57
So why does the token expire even when there have been multiple orders processed in the last week?
because the developer stinks?
i do not know.
how many clients do you have using this module? is it happening to all of them? is anyone else on the forum having this problem?
best.
-
Re: Square WebPay support thread.
> because the developer stinks?
Dunno - I've heard good things. They say he is a bit OCD about formatting though.
-
Re: Square WebPay support thread.
Some people seem to get the "OAuth access token has expired" more often than others - not sure why.
Are people just preventatively renewing the token every couple of weeks to prevent this issue?
-
Re: Square WebPay support thread.
I have a cron job that runs every 3 days that seems to keep my square web pay alive.
I set it to run at 01:01 every 3 days 1 1 */3 * * with the command php PATH_TO_M_STORE/squareWebPay_handler.php
-
Re: Square WebPay support thread.
Possibly because it's server dependent but the php command cron didn't work for me. From a post by @dbltoe the command I now use
HTML Code:
/usr/bin/wget https://mydomainDOTcom/squareWebPay_handler.php
the scheduling is set in the control panel. Seems to be working.
-
Re: Square WebPay support thread.
OTOH,
I've got one site without cron that has had no sales since the update to webpay.
Yet, the thing has never dropped.
go figure.
-
Re: Square WebPay support thread.
Run a test order to be sure it truly works?
-
Re: Square WebPay support thread.
@proseLA - I'm adding this to the documentation unless you have objections:
Run a cron job every 3 days with the command
/usr/bin/wget https://YOURSTORE/squareWebPay_handler.php
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
swguy
if that works for people, that would be great.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
swguy
Run a test order to be sure it truly works?
Actually, i just go to the mod, click on edit, and then click on update.
I've found that action alone will let you know if things are not right.
BTW, I had specifically left this site without a cron to see when and if it would drop.
-
Re: Square WebPay support thread.
@carlwhat thanks.
@dbltoe thanks for that - I'll advise using one of these two methods.
-
Re: Square WebPay support thread.
-
Re: Square WebPay support thread.
Having another go at installing this version. I notice this warning was in an earlier post but as it wasn't the main issue it never got addressed.
PHP Code:
[06-Sep-2022 16:00:53 Europe/London] Request URI: /...../admin/index.php?cmd=orders&page=1&oID=31216&action=edit, IP address: xxx.xxx.xxx.xxx
#1 square_webPay->__construct() called at [/admin/orders.php:521]
#2 require(/admin/orders.php) called at [/admin/index.php:11]
--> PHP Warning: Use of undefined constant MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE - assumed 'MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE' (this will throw an Error in a future version of PHP) in /includes/modules/payment/square_webPay.php on line 106.
[06-Sep-2022 16:00:53 Europe/London] Request URI: /..../admin/index.php?cmd=orders&page=1&oID=31216&action=edit, IP address: xxx.xxx.xxx.xxx
#1 square_webPay->__construct() called at [/admin/orders.php:521]
#2 require(/admin/orders.php) called at [/admin/index.php:11]
--> PHP Warning: Use of undefined constant MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN - assumed 'MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN' (this will throw an Error in a future version of PHP) in /includes/modules/payment/square_webPay.php on line 111.
I can add quotes to the code to get rid of the warning but I'm not convinced this is the solution as nobody else seems to have the issue.
I am using V1.0.1 from the downloads on Zen V1.5.7d and PHP 7.4
Any pointers please?
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
Brent
Having another go at installing this version. I notice this warning was in an
earlier post but as it wasn't the main issue it never got addressed.
PHP Code:
[06-Sep-2022 16:00:53 Europe/London] Request URI: /...../admin/index.php?cmd=orders&page=1&oID=31216&action=edit, IP address: xxx.xxx.xxx.xxx
#1 square_webPay->__construct() called at [/admin/orders.php:521]
#2 require(/admin/orders.php) called at [/admin/index.php:11]
--> PHP Warning: Use of undefined constant MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE - assumed 'MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE' (this will throw an Error in a future version of PHP) in /includes/modules/payment/square_webPay.php on line 106.
[06-Sep-2022 16:00:53 Europe/London] Request URI: /..../admin/index.php?cmd=orders&page=1&oID=31216&action=edit, IP address: xxx.xxx.xxx.xxx
#1 square_webPay->__construct() called at [/admin/orders.php:521]
#2 require(/admin/orders.php) called at [/admin/index.php:11]
--> PHP Warning: Use of undefined constant MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN - assumed 'MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN' (this will throw an Error in a future version of PHP) in /includes/modules/payment/square_webPay.php on line 111.
I can add quotes to the code to get rid of the warning but I'm not convinced this is the solution as nobody else seems to have the issue.
I am using V1.0.1 from the downloads on Zen V1.5.7d and PHP 7.4
Any pointers please?
hey brent,
that has been fixed, but i have not uploaded it for a new version. you should replace lines 105-118 with the following code:
PHP Code:
$environment = Environment::PRODUCTION;
if (defined('MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE') && MODULE_PAYMENT_SQ_WEBPAY_TESTING_MODE === 'Sandbox') {
$environment = Environment::SANDBOX;
}
$this->token= '';
if (defined('MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN')) {
$this->token = MODULE_PAYMENT_SQ_WEBPAY_ACCESS_TOKEN;
}
$this->client = new SquareClient([
'accessToken' => $this->token,
'environment' => $environment,
]);
$this->oauthClient = new SquareClient([
'environment' => $environment,
]);
if (IS_ADMIN_FLAG === true) {
there's actually 4 new lines in there and 2 changed lines.
let me know if you run into any other problems.
best.
-
Re: Square WebPay support thread.
Thank you kind sir! That did the trick :smile:
-
Re: Square WebPay support thread.
Since switching I've had a number of customers reporting their transaction is declined but I don't get any error logs my end. I am getting orders through so it is card type or issuing bank dependant. I think it may be card type as I had one user who could not get their credit card to work but as soon as they tried debit card it went through.
I've now enabled logging on success and failure but don't think this will help me troubleshoot. Also I don't think there is a way to differentiate between credit and debit card in the Square portal so I could investigate that theory?
-
Re: Square WebPay support thread.
Square should have logs on their side that will help you troubleshoot this.
-
Re: Square WebPay support thread.
Thanks Scott. Already checked the API logs and the only 401 errors were ObtainToken and these were from last week when I was setting the module up originally.
Everything seems to be working perfectly if it wasn't for the user reports. I put the first few down to user error but my gut now tells me there is an issue.
Assume I should still be using API version 2022-02-16?
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
Brent
Thanks Scott. Already checked the API logs and the only 401 errors were ObtainToken and these were from last week when I was setting the module up originally.
Everything seems to be working perfectly if it wasn't for the user reports. I put the first few down to user error but my gut now tells me there is an issue.
Assume I should still be using API version 2022-02-16?
brent,
unfortunately i can not debug based on a gut feeling. if you have any error logs, by all means go ahead and post them.
you can change the constant MODULE_PAYMENT_SQ_WEBPAY_LOGGING to Log Always, and see what happens.
the potential for problems could be before ZC sends any data to square, which should hopefully generate an error log. else if the data gets sent to square then you should see it on the API dashboard on the square web site. if you have log always on, you should see that Square log as well in your logs directory.
and yes that is the correct API version to use.
best.
-
Re: Square WebPay support thread.
/usr/bin/wget https://YOURSTORE/squareWebPay_handler.php This is the cron cmd to use, right?
-
Re: Square WebPay support thread.
There is discussion on this higher up in the thread. The broad outline is covered in the docs now though.
https://docs.zen-cart.com/user/payme..._token_expiry/
-
Re: Square WebPay support thread.
-
Re: Square WebPay support thread.
Using Ver 1.5.7 ppatch 1, I've tried installing the new square module twice. Neither time did it show up under the payment module on the admin site. Any ideas?
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
pazdar
Using Ver 1.5.7 ppatch 1, I've tried installing the new square module twice. Neither time did it show up under the payment module on the admin site. Any ideas?
i would say you are not installing it properly.
i think all that is needed is a language file and a payment module for a payment module to show up in the admin. they need to be in the right places.
without any log files, i am only venturing a guess. but plenty of store owners were able to get it to show up on the admin with nothing more than the directions that come with the module.
make sure you have not uploaded the for_upload directory.
best.
-
Re: Square WebPay support thread.
Good evening;
After seeing your email, I erased the payment file under modules, re-uploaded it from the master file for v1.5.7, then re-uploaded the square module. Now it shows up. This time I'm getting "ALERT: Access Token not set:" I do have it set to the correct location. Do I need to change anything in any of the files?
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
pazdar
Good evening;
After seeing your email, I erased the payment file under modules, re-uploaded it from the master file for v1.5.7, then re-uploaded the square module. Now it shows up. This time I'm getting "ALERT: Access Token not set:" I do have it set to the correct location. Do I need to change anything in any of the files?
i have recently reviewed the docs here:
https://docs.zen-cart.com/user/payment/square/
and found them to be VERY helpful with installation and problem solving.
if you go through those docs and still can not get it working, by all means, come back here.
best.
-
Re: Square WebPay support thread.
Thanks, I went through them, still not working. Here's what I'm seeing:
ALERT: Access Token not set:
1. Make sure the OAuth Redirect URL in your Square Account "app" is set to
https://www.pazd..........
I've double checked and the handler file is in the main directory
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
pazdar
Thanks, I went through them, still not working. Here's what I'm seeing:
ALERT: Access Token not set:
1. Make sure the OAuth Redirect URL in your Square Account "app" is set to
https://www.pazd..........
I've double checked and the handler file is in the main directory
have you done this part here:
https://docs.zen-cart.com/user/payme...e-web-payments
your access token is bad...
-
Re: Square WebPay support thread.
Yes, I get this:
ALERT: Access Token not set:
1. Make sure the OAuth Redirect URL in your Square Account "app" is set to
https://www.pazdarwinery.com/squareWebPay_handler.php
2. And then (click on green button)
I do that and I get a blank screen with this address:
https://www.pazdarwinery.com/squareW...1f13ed7ce4#_=_
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
pazdar
i'm getting a 500 response code from your site and the squareWebPay_handler. which indicates some sort of server issue.
do you have any logs?
i would also look in the handler for the $verbose = false; and change that to $verbose = true;
-
Re: Square WebPay support thread.
After uploading the files I get the following error in the log files:
PHP Fatal error: Uncaught Error: Class "Square\Environment" not found in MY_PATH/includes/modules/payment/square_webPay.php:105
Stack trace:
#0 /MY_PATH/modules.php(204): square_webPay->__construct()
#1 /: require('/home/tim/zenca...')
#2 {main}
thrown in /MY_PATH/includes/modules/payment/square_webPay.php on line 105
There appears no webpay module in Modules->Payment.
php Version is 8.0
Zen Cart 1.5.7d
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
todoonada
After uploading the files I get the following error in the log files:
PHP Fatal error: Uncaught Error: Class "Square\Environment" not found in MY_PATH/includes/modules/payment/square_webPay.php:105
Stack trace:
#0 /MY_PATH/modules.php(204): square_webPay->__construct()
#1 /: require('/home/tim/zenca...')
#2 {main}
thrown in /MY_PATH/includes/modules/payment/square_webPay.php on line 105
There appears no webpay module in Modules->Payment.
php Version is 8.0
Zen Cart 1.5.7d
you have not properly uploaded all the files in the zip. specifically the directory here:
/MY_PATH/includes/modules/payment/square_webPay/
there are a number of directories and more files there. those are all required.
-
Re: Square WebPay support thread.
I tried setting it to "true"
Here is the error report I get:
[14-Oct-2022 14:10:32 America/Boise] SQUARE TOKEN REQUEST - auth code for exchange: sq0cgp-kqtdUqf6zPos4IikZi1WFQ
Array
(
[code] => sq0cgp-kqtdUqf6zPos4IikZi1WFQ
[response_type] => code
[state] => 932ee36d66d8eff178bf665e995eebc55857a15ee927e385822656fe450d2cbd
[main_page] => index
)
[14-Oct-2022 14:10:32 America/Boise] PHP Fatal error: Uncaught Error: Class 'Unirest\Request' not found in /includes/modules/payment/square_webPay/square/square/src/Apis/BaseApi.php:64
Stack trace:
#0 /includes/modules/payment/square_webPay/square/square/src/Apis/OAuthApi.php(22): Square\Apis\BaseApi->__construct(Object(Square\SquareClient), Array, NULL)
#1 /includes/modules/payment/square_webPay/square/square/src/SquareClient.php(327): Square\Apis\OAuthApi->__construct(Object(Square\SquareClient), Array, NULL)
#2 /includes/modules/payment/square_webPay.php(694): Square\SquareClient->getOAuthApi()
#3 /squareWebPay_handler.php(33): square_webPay->exchangeForToken('sq0cgp-kqtdUqf6...')
#4 {main}
thrown in /includes/modules/payment/square_webPay/square/square/src/Apis/BaseApi.php on line 64
[14-Oct-2022 14:10:32 America/Boise] Request URI: /squareWebPay_handler.php?code=sq0cgp-kqtdUqf6zPos4IikZi1WFQ&response_type=code&state=932ee36d66d8eff178bf665e995eebc5 5857a15ee927e385822656fe450d2cbd, IP address: 69.206.192.57
--> PHP Fatal error: Uncaught Error: Class 'Unirest\Request' not found in /includes/modules/payment/square_webPay/square/square/src/Apis/BaseApi.php:64
Stack trace:
#0 /includes/modules/payment/square_webPay/square/square/src/Apis/OAuthApi.php(22): Square\Apis\BaseApi->__construct(Object(Square\SquareClient), Array, NULL)
#1 /includes/modules/payment/square_webPay/square/square/src/SquareClient.php(327): Square\Apis\OAuthApi->__construct(Object(Square\SquareClient), Array, NULL)
#2 /includes/modules/payment/square_webPay.php(694): Square\SquareClient->getOAuthApi()
#3 /squareWebPay_handler.php(33): square_webPay->exchangeForToken('sq0cgp-kqtdUqf6...')
#4 {main}
thrown in /includes/modules/payment/square_webPay/square/square/src/Apis/BaseApi.php on line 64.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
you have not properly uploaded all the files in the zip. specifically the directory here:
/MY_PATH/includes/modules/payment/square_webPay/
there are a number of directories and more files there. those are all required.
I uploaded all files, so missing files were not the problem.
I found the reason why I can not see the WebPay module and get aforementioned error:
When I am on PHP-version 8.0.17 I get an error.
Switching to PHP 7.4.28, I do not get an error and the module shows up.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
todoonada
I uploaded all files, so missing files were not the problem.
I found the reason why I can not see the WebPay module and get aforementioned error:
When I am on PHP-version 8.0.17 I get an error.
Switching to PHP 7.4.28, I do not get an error and the module shows up.
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:
Code:
[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.
-
Re: Square WebPay support thread.
@pazdar
on your square dashboard, what version of the api are you using?
you should be on:
API version
2022-02-16
i am not sure if that is your problem, but i would start there.
best.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
pazdar
--> PHP Fatal error: Uncaught Error: Class 'Unirest\Request' not found in /includes/modules/payment/square_webPay/square/square/src/Apis/BaseApi.php:64
is this file on your server:
includes/modules/payment/square_webPay/apimatic/unirest-php/src/Unirest/Request.php
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
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:
Code:
[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:
Code:
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.
-
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.)
-
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/16EU...ew?usp=sharing
Image of screen while it loads .. almost takes 10 seconds or more sometimes - https://drive.google.com/file/d/1DuD...ew?usp=sharing
-
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....47#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).
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
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....47#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.
-
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.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
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:
-
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.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
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.
-
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.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
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:
PHP Code:
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.
-
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.
-
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.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
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.
どういたしまして
-
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.
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
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).
-
Re: Square WebPay support thread.
Quote:
Originally Posted by
todoonada
The WebPay module works great...
:thumbsup:
-
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.
-
Re: Square WebPay support thread.
Installed the new 1.0.2 on 1.5.7d with OPC.
Getting
Code:
[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.
-
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?