Simon
Nick Smith - Venture Design and Print
https://venturedesignandprint.co.uk
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:
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.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
Today I got a debug log:
I also received a square alert: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.
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.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__ ....
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
My store - closed 12/05/2023
1.5.7d (upgraded from 1.5.7b), clone a template (cloned Responsive Classic Template), Sitemap XML v4.0, Square WebPay, PayPal Express Checkout, PHP Version: 7.4.29 (Zend: 3.4.0)
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.
My store - closed 12/05/2023
1.5.7d (upgraded from 1.5.7b), clone a template (cloned Responsive Classic Template), Sitemap XML v4.0, Square WebPay, PayPal Express Checkout, PHP Version: 7.4.29 (Zend: 3.4.0)
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!
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.![]()
My store - closed 12/05/2023
1.5.7d (upgraded from 1.5.7b), clone a template (cloned Responsive Classic Template), Sitemap XML v4.0, Square WebPay, PayPal Express Checkout, PHP Version: 7.4.29 (Zend: 3.4.0)
> 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.
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
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!
My store - closed 12/05/2023
1.5.7d (upgraded from 1.5.7b), clone a template (cloned Responsive Classic Template), Sitemap XML v4.0, Square WebPay, PayPal Express Checkout, PHP Version: 7.4.29 (Zend: 3.4.0)
Are You Vulnerable for an Accessibility Lawsuit?
myZenCartHost.com - Zen Cart Certified, PCI Compatible Hosting by JEANDRET
Free SSL & Domain with semi-annual and longer hosting. Updating 1.5.2 and Up.
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.
Bookmarks