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.