Problem: The response is not a valid JSON response.
-
Hi,
After PayPal button click it opens a popup, but after 2-3 seconds it dissapears and I can see the message “The response is not a valid JSON response.”.
In Woocommerce logs I can’t see anything related to this issue.
Any idea how to fix it?
Thank you
-
Hi @luispf39
There isn’t a
wc-ppcp
log file? If there isn’t than the issue is most likely not related to the PayPal plugin.Any idea how to fix it?
That error message usually indicates your server is outputting a string when a JSON object is expected. Strings are typically generated when some plugin triggers a PHP notice.
Can you share your website url?
Kind Regards
Getting something similar and in the logs for wc-ppcp is written: Error Error creating PayPal order. Msg:Request is not well-formed, syntactically incorrect, or violates schema. Params: Array . That seems to be the case since the latest Woocommerce 7.5.0. Here are digital files (pictures) sold so no address or country code is needed.
Some more Info on it:
[0] => Array ( [field] => /payer/address/country_code [value] => undefined [location] => body [issue] => INVALID_PARAMETER_SYNTAX [description] => The value of a field does not conform to the expected format. ) [1] => Array ( [field] => /payer/address/country_code [value] => undefined [location] => body [issue] => INVALID_STRING_LENGTH [description] => The value of a field is either too short or too long. ) ) [links] => Array ( [0] => Array ( [href] => https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_PARAMETER_SYNTAX [rel] => information_link [encType] => application/json ) [1] => Array ( [href] => https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_STRING_LENGTH [rel] => information_link [encType] => application/json )
- This reply was modified 1 year, 8 months ago by larsvonhierblau.
The
wc-ppcp
log file should show the exact reason for any failed API request. What is the full log entry?Thanks
I just replied above
@larsvonhierblau That error is showing that the customer’s billing address has an empty country code, which should not happen.
Is this error occuring when the PayPal button is clicked or after the PayPal popup closes and the payment is being processed?
Is the billing country not required on your checkout page or is it set to a default value?
A billing address is not required hence these are digital products so it was removed from the checkout. However, the default address is the shop country code and it still doesn’t work.
Thats happening when you press the paypal button. The popup from PayPal shows short and right after it’ll return an error message:
Request is not well-formed, syntactically incorrect, or violates schema.
- This reply was modified 1 year, 8 months ago by larsvonhierblau.
A billing address is not required hence these are digital products so it was removed from the checkout.?
That’s the source of the issue I believe. Some fields are necessary for processing a payment, the billing country being one of them. Since you have removed it from your checkout page, the value being sent to PayPal is empty.
It’s generally a good idea to include billing address fields as they are used internally by PayPal for fraud detection.
You can reach out to us using our contact us page if you would like us to review your particular setup to see what can be done for this scenario.
Thanks
I will check on this, but it’s rather common to not have address fields present in the checkout for digital products. There are even entire plugins only doing this: https://www.ads-software.com/plugins/woo-checkout-for-digital-goods/
Your plugin has worked flawlessly until today, and the only thing what was changed was the Update to woocommerce 7.5.0
Your plugin has worked flawlessly until today, and the only thing what was changed was the Update to woocommerce 7.5.0
Have you attempted to revert to version 7.4 of WC to test?
Is this happening with all digital orders or just one in particular?
On all digital orders. I tested it now with adding back the country and address and you are right. It then worked in an instant. However, it has been working like this just fine for 3 years or so.
It’s possible one of your other plugins that removes the billing address isn’t playing nice with WC 7.5
You can use our contact us page if you would like us to take a closer look.
Thanks
I did downgrade it’s not related to the woocommerce update. However, I installed another older PayPal plugin ( https://www.ads-software.com/plugins/woocommerce-gateway-paypal-express-checkout/ ) which was canceled for updates and it works just fine. I am not sure what is the issue suddenly.
I am not sure what is the issue suddenly.
When things stop working suddenly, it’s usually the result of a change on your site, like an update. If you updated any plugins other than WC I would check there.
Per my previous replies, you can use our contact us page if you’d like us to take a closer look.
Thanks for your suggestion. Truly appreciate it. For now, I will revert this to the other plugin hence it seems to work. There was no other change than woocommerce 7.5.0
@larsvonhierblau Setting to resolved. Looks like you’re using another PayPal plugin now.
Kind Regards
- The topic ‘Problem: The response is not a valid JSON response.’ is closed to new replies.