NOTE: As of WP Simple Pay Pro 3.6.0 and Lite 2.3.0, usage of PHP sessions has removed.
Sometimes you or your site visitors might experience issues related to caching while using WP Simple Pay. In most cases, this is because your web host has it’s own caching rules in place or you have a caching plugin configured on your site. Both are good things for your site’s overall load times and performance but can block some of the checkout messaging of WP Simple Pay.
For starters you’ll want to make sure your payment success and failure pages are excluded from any site caching.
With some web hosts such as WP Engine, you’ll need to contact your host and let them know to exclude these pages (URLs) from caching.
If you’re using a caching plugin, you may need to specify which pages to exclude from caching. By default, WP Simple Pay turns off caching for the payment success and failure pages by using the standard
DONOTCACHEPAGE constant. Most popular WordPress caching plugins will detect this constant and disable caching on these pages if it’s set to true. If you need to specify additional page cache exclusions via code, you can start with this filter hook example from our code snippet library.
Some web hosts will use advanced caching techniques to automatically make your site run more smoothly. This is great, but you might find that sometimes you will need to purge this cache to make sure your forms are using the latest version of the plugin files. You will want to look around in your WordPress admin for some kind of “purge cache” button to clear this all out. If you cannot find one then you can contact your host to ask them for assistance. Below is an example of how this looks for SiteGround.
The best solution for this is to just clear the browser cache and then reload the page. Some browsers, such as Google Chrome, let you perform a “hard reload” of the page. To do this in Chrome, first, open the console log window (Cmd-Alt-J or F12). Next, right-click the reload button and select “Empty Cache and Hard Reload”. Similar functionality should exist in other browsers as well.
Invalid Cookie Nonce
If you see this error (or
rest_cookie_invalid_nonce) on your payment pages, it usually occurs when the WordPress REST API security nonce has expired due to caching.
If you have caching enabled, ensure the cache does not last longer than 12 hours to avoid the nonces staying around longer than their expiration.
You can also exclude the payment page from your caching scheme.
406 Not Acceptable
Error 406 Not Acceptable is generally caused because a request has been blocked by Mod Security. Mod Security is an open source firewall solution often applied to web servers. If you see a similar message when returning from the Stripe.com hosted Stripe Checkout payment page please contact your web host to resolve the issue by removing the restrictions.