Re: Square WebPay support thread.
Make sure the module settings have "Purchase" selected under Transaction Type.
Re: Square WebPay support thread.
Thank you, I wish many things in life to be so simple to fix :-)
Re: Square WebPay support thread.
I have to come back to the error I already posted at #356 in this thread.
I find this error more often now in the log files. It is an error in the source files of Square. I can not recreate this error and don't understand what could cause this error.
--> PHP Fatal error: Uncaught TypeError: Square\ApiHelper::serialize(): Return value must be of type string, bool returned in /includes/modules/payment/square_webPay/square/square/src/ApiHelper.php:113
I did not receive any Square Alert mail about this error.
I use Zen Cart v1.5.7d and php 8.0.25
Has anybody any idea what could cause this error?
Re: Square WebPay support thread.
Quote:
Originally Posted by
todoonada
I have to come back to the error I already posted at #356 in this thread.
I find this error more often now in the log files. It is an error in the source files of Square. I can not recreate this error and don't understand what could cause this error.
--> PHP Fatal error: Uncaught TypeError: Square\ApiHelper::serialize(): Return value must be of type string, bool returned in /includes/modules/payment/square_webPay/square/square/src/ApiHelper.php:113
I did not receive any Square Alert mail about this error.
I use Zen Cart v1.5.7d and php 8.0.25
Some additional information about this problem.
I have my product names in this style: Japanese Name of Product <br /> English Name of the Product
So it looks like this: プラスティックボトル 1000ml<br />Plastic Bottle 1000ml in the input field of the product manager.
Yesterday I saw a customer who had this problem in the "Whos Online" list of the backend. Since the error happened in the serialize function, I somehow had a feeling it has something to do with the product name or the html tag in the product name.
So I made notes of the items the customer had in the cart and changed the product names of those items to Japanese Name of Product (I removed <br /> English Name of the Product ).
The customer tried a while later to check out again and it worked. Of course I do not know if the customer changed something on his side. Japanese has some different input methods and it might be a certain input method caused the error.
Also it does not explain why most customers can check out without any problem and with the full product name (Japanese Name of Product <br /> English Name of the Product) .
I also asked in the Square developer forum, but they thought it is a problem of the Zen Cart API.
Re: Square WebPay support thread.
Quote:
Originally Posted by
todoonada
Some additional information about this problem.
I have my product names in this style:
Japanese Name of Product <br /> English Name of the Product
So it looks like this:
プラスティックボトル 1000ml<br />Plastic Bottle 1000ml in the input field of the product manager.
Yesterday I saw a customer who had this problem in the "Whos Online" list of the backend. Since the error happened in the serialize function, I somehow had a feeling it has something to do with the product name or the html tag in the product name.
So I made notes of the items the customer had in the cart and changed the product names of those items to
Japanese Name of Product (I removed
<br /> English Name of the Product ).
The customer tried a while later to check out again and it worked. Of course I do not know if the customer changed something on his side. Japanese has some different input methods and it might be a certain input method caused the error.
Also it does not explain why most customers can check out without any problem and with the full product name (
Japanese Name of Product <br /> English Name of the Product) .
I also asked in the Square developer forum, but they thought it is a problem of the Zen Cart API.
more information is always better. i will try and take a look at this and see if i can reproduce it.
best.
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
more information is always better. i will try and take a look at this and see if i can reproduce it.
best.
Thank you.
I have another question: How can I test the Square WebPay module without doing any cc transfers? I would like to reproduce the error, but do not want to make lots of payments and later cancel all. Square would probably also not like this.
Re: Square WebPay support thread.
Quote:
Originally Posted by
todoonada
Thank you.
I have another question: How can I test the Square WebPay module without doing any cc transfers? I would like to reproduce the error, but do not want to make lots of payments and later cancel all. Square would probably also not like this.
you need to create sandbox credentials and enter them in the admin.
one should have a development site to do sandboxing, else you should put your site into maintenance mode.
hope that helps.
Re: Square WebPay support thread.
Quote:
Originally Posted by
todoonada
....
I also asked in the Square developer forum, but they thought it is a problem of the Zen Cart API.
can you please provide a link to where you were asking this question in the square developer forum?
thanks in advance.
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
i have not seen this error.
it will be a tricky one to figure out as the error is coming from the square SDK.
you could try changing line 108 from includes/modules/payment/square_webPay/square/square/src/ApiHelper.php as below, but it is a pure guess on my part.
PHP Code:
//from
public static function serialize($value): string
//to
public static function serialize($value): ?string
and i'm unsure what else that might affect.
best.
i am also coming back to my attempted solution here. have you tried it?
i have done some debugging, and it looks like the serialize function is taking the array of the whole order.
the problem is something in the array is not in utf8 encoding. so the most likely culprit is the japanese product name. it is NOT the <br /> in the product name string.
i would check the encoding of the product name that you think is causing the problem. i am not the character encoding king, nor do i fully understand it. but that's my guess.
we could add some checking to get the last error if you are so inclined. but i am curious about my other questions on this issue.
best.
Re: Square WebPay support thread.
Quote:
Originally Posted by
carlwhat
can you please provide a link to where you were asking this question in the square developer forum?
Thanks for your help!
This is the link: https://developer.squareup.com/forum...rialize/8224/4
I did not try your suggested solution yet, because I do not like to change anything while not knowing the reason. I also checked the product names the people who had problems checking out, had in their cart, but could not find any pattern.
There is also the possibility, that the people use some unexpected encoding for the data they provide. This whole encoding stuff in Japanese is quite annoying and I am not very familiar with it.
On a side note, not connected with the payment problem: very rarely some Kanji are shown with a placeholder in the backend of Zen Cart. On the invoice the same Kanji is displayed correctly, though.
First step for me would be to find out what causes the error. Of course I have a test shop running on a local Apache, but I did not do the Square sandbox setup yet. I have a feeling, it might be some combination of circumstances which lead to the error.