Response not a valid json response
-
I tried testing my cart … but when the PayPal window opened, I got the message “Response not a valid json response”.
So, I checked my settings and realized that I had the incorrect Client ID … so I reentered the id and secret. Then, to be safe, I was going to delete the connection, and then reconnect (which I assumed would use the new ID and secret). However, every time I try to delete the connection, I get the same error (see https://ibb.co/brscZGw for a screenshot )
Also, I checked the WooCommerce logs, and there is nothing in there for the issue… (no error logs at all today)
-
Hi @jabbamonkey,
That issue is usually the result of a 3rd party plugin that’s incorrectly echoing output during what should be a JSON only response. Since the offending plugin echo’s some content, the result is not a pure JSON object and the browser can’t parse it, so you get that error.
Try clicking F12 using Chrome and click the Network tab. You should be able to see what the output from the server looks like. Please provide that info so we can review.
Kind Regards
Are you talking about the Chrome developer console?
The following errors occur…Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received api-fetch.min.js?ver=0fa4dabf8bf2c7adf21a:2 POST https://mystorename.store/wp-admin/admin-ajax.php?action=wc_ppcp_admin_request&path=%2Fwc-ppcp%2Fv1%2Fadmin%2Faccount%2Fconnect&_locale=user 500 (Internal Server Error)Are you talking about the Chrome developer console?
Yes, that is what I am talking about.
The following errors occur
I can see the server is responding with an HTTP 500 which usually indicates a PHP exception. Go to the WooCommerce > Status > Logs page and look for a
fatal-errorslog file with the most recent timestamp. Please share the contents of that log file so it can be reviewed.Kind Regards
This error keeps repeating in one log….
2023-12-15T00:54:30+00:00 ERROR API error: Array ( [url] => https://api-m.paypal.com/v1/oauth2/token [method] => POST [http_status] => 401 [request] => Array ( [grant_type] => client_credentials ) [error] => Array ( [error] => invalid_client [error_description] => Client Authentication failed ) )It says invalid client…. but I checked the client id and secret, and copied and pasted it directly.
There is also an error log pointing to test-log.log … but I’m not sure how to view that file (or where it is on the server)
-
This reply was modified 2 years, 5 months ago by
jabbamonkey.
Either way… if I am trying to delete the connection, shouldn’t it NOT affect the deletion? (why need the client id and authorization)
Also, I just tried to deactive all the plugin, except wooCommerce and the Payments plugin, but the error still occurs….
-
This reply was modified 2 years, 5 months ago by
jabbamonkey.
It says invalid client…. but I checked the client id and secret, and copied and pasted it directly.
The PayPal API only rejects requests if the secret is incorrect.
Either way… if I am trying to delete the connection, shouldn’t it NOT affect the deletion? (why need the client id and authorization)
It doesn’t. You’re looking at the
wc-ppcplog file which logs all failed requests to PayPal. The log file I mentioned in my previous reply is namedfatal-errorsand contains PHP exceptions, etc.There is also an error log pointing to test-log.log … but I’m not sure how to view that file (or where it is on the server)
On the WooCommerce > Status > Logs page, on the right-hand side of the logs dropdown, there should be a
Viewbutton which when clicked will load the selected log file.Also, I just tried to deactive all the plugin, except wooCommerce and the Payments plugin, but the error still occurs….
We have no other reports of this being an issue and I just tested the Delete button on our development site and it worked as expected. Try finding that
fatal-errorslog as that will provide the most helpful information.Kind Regards
There is just the wc-ppcp log, which I pasted the first portion …
… and the test-log.log … but the view button comes up emptySee image below…
https://ibb.co/yyk5LGjSee image below…
That’s odd, WooCommerce usually logs any PHP exceptions which are encountered.
You can always just re-enter your client ID and secret key values which override whatever is currently in the database.
The Delete Connection button deletes the current client ID and secret key that are stored in your database. If you already re-entered the correct values then you don’t need that functionality.
Kind Regards
Well, I went to paypal, grabbed my ID and SECRET, and pasted them back into the PayPal Payments page … I then tried to CHECKOUT of my shop…
When I click the yellow “PayPal Checkout” button, the popup opens …
https://ibb.co/QvH0bk5… And after awhile, it goes away and results in the same “Response not a valid json response” error….
https://ibb.co/0KvmNjZIt looks like the request to PayPal is timing out. Make sure your server is not blocking outbound requests to providers like PayPal. Some hosting companies apply aggressive restrictions out of the box.
My webhost didn’t notice a problem on their end. Their response…
“I do not see anything at our end that will prevent this. Only thing I see in the server logs is mod security rules being triggered, I have adjusted these in case that is causing the issue.”And I just tried to CHECKOUT, and am still getting the issue.
I just tested your site again and PayPal is working now, so it seems you were able to resolve the issue.
-
This reply was modified 2 years, 5 months ago by
The topic ‘Response not a valid json response’ is closed to new replies.