Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could Not Validate Nonce Error (204) #239

Closed
Dinamiko opened this issue Sep 6, 2021 · 2 comments · Fixed by #336 · May be fixed by #240
Closed

Could Not Validate Nonce Error (204) #239

Dinamiko opened this issue Sep 6, 2021 · 2 comments · Fixed by #336 · May be fixed by #240
Labels
bug Something isn't working
Milestone

Comments

@Dinamiko
Copy link
Contributor

Dinamiko commented Sep 6, 2021

Describe the bug

Merchants are experiencing this error:

021-07-30T21:28:37+00:00 CRITICAL Uncaught WooCommerce\PayPalCommerce\Button\Exception\RuntimeException: Could not validate nonce. in /var/www/html/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Endpoint/class-requestdata.php:50
Stack trace:
#0 /var/www/html/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Endpoint/class-dataclientidendpoint.php(69): WooCommerce\PayPalCommerce\Button\Endpoint\RequestData->read_request('ppc-data-client...')
#1 /var/www/html/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/class-buttonmodule.php(111): WooCommerce\PayPalCommerce\Button\Endpoint\DataClientIdEndpoint->handle_request()
#2 /var/www/html/wp-includes/class-wp-hook.php(303): WooCommerce\PayPalCommerce\Button\ButtonModule::WooCommerce\PayPalCommerce\Button\{closure}('')
#3 /var/www/html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array)
#4 /var/www/html/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#5 /var/www/html/wp-content/plugins/woocommerce/includes/clas in /var/www/html/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Endpoint/class-requestdata.php on line 50

To reproduce

  • Visit WooCommerce > Settings > Accounts & Privacy
  • Disable the guest user checkout option (first checkbox)
    image
  • Enable option to register account in checkout
  • Enable either of the checkboxes to auto-generate account name/password (both also cause the behavior)
  • Visit checkout as logged out user and create an order
  • A user account will be registered automatically (depending on the settings with auto-generated name or password)
  • Payment popup window will result in a loop until the user manually refreshed the site
  • After the site refresh, the user is logged into his newly created account and can complete the payment
PayPal.Payments.-.checkout.registration.mp4

Also there is another problem which is present even when the guest checkout is enabled and the “Create account” checkbox is checked.

Sometimes instead of finishing the order the checkout page is reloaded, resulting in bad UX + it is not possible to finish ordering because of duplicated PayPal order.

It seems random, sometimes it finishes fine, sometimes it reloads the checkout page. I think it is reproduced more often when DevTools is opened. So maybe there is a bug related to caching of HTTP requests and/or a race condition.

Possible cause

We use createaccount checkbox to determine whether the user needs to created

if ( isset( $data['createaccount'] ) && '1' === $data['createaccount'] ) {

which is present only if Allow customers to place orders without an account + Allow customers to create an account during checkout are enabled.

Environment

  • WordPress Version: 5.8, 5.3
  • WooCommerce Version: 5.6, 4.7
  • WooCommerce PayPal Payments Plugin Version: 1.5.1
@Dinamiko Dinamiko added this to the Release 1.6.0 milestone Sep 6, 2021
@Dinamiko Dinamiko added the bug Something isn't working label Sep 6, 2021
@isabellainpsyde isabellainpsyde changed the title Could Not Validate Nonce Error Could Not Validate Nonce Error (204) Oct 7, 2021
@AlexP11223
Copy link
Contributor

* Enable either of the checkboxes to auto-generate account name/password (both also cause the behavior)

I don’t see any effect from enabling the auto-generation options, just Allow customers to create an account during checkout is enough to get the error and loop.

@AlexP11223
Copy link
Contributor

AlexP11223 commented Oct 20, 2021

Looks like there is another bug related to registration (and to the testing of this issue after fixing the loop bug), updated the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants