woocommerce-gateway-paypal-express-checkout
woocommerce-gateway-paypal-express-checkout copied to clipboard
Input returned by PayPal Checkout causes JSON error and causes conflicts.
Describe the bug
Hi there, this comes from the WordPress.org forums for this plugin. I was curious what your thoughts would be for this.
WS optin nonce cause Paypal Checkout to fail.
I have an issue with the optin on the checkout page for Paypal only (Stripe works) where the hidden input field with a nonce added by Sendinblue causes the following error with Paypal checkout due to malformed Json. The response of the xhr call via Paypal indeed returns the following raw response:
<input type="hidden" class="ws_opt_in_nonce" name="ws_opt_in_nonce" value= "91eed72c0a"> {"success":true,"data":{"token":"EC-95612932HX675794C"}}
As you can see the input is returned by Paypal causing a malformed json error resulting the following error:
create_order_error {err: "SyntaxError: Unexpected token < in JSON at positio…bility,messages&commit=true¤cy=EUR:2:128921", timestamp: "1625481094169", referer: "www.paypal.com", sdkCorrelationID: "a082f9f50c502", sessionID: "uid_1dd075158a_mta6mze6mdq", …}
This occurs despite the response returning “success”.
It has to do with the way form inputs are serialized by PayPal. Any ideas on how to fix? The plugin I am using is Sendinblue Marketing. It may be because the hidden field nonce is appended to the the top of the form.
To reproduce
- Install PayPal Checkout and Sendinblue plugin.
- Attempt to cheeckout
- See error