API error saves as cache at checkout
-
Hi,
If a customer get any API-error it is then saved as cache at the site. Other customers then receive the same API-error message.
Do you have any solution for this? I did just add that the checkout in the field “Do Not Cache URIs”
Will that solve the issue or is there any other thing I need to do?
Thanks
BR
AndreasThe page I need help with: [log in to see the link]
-
what kind of API ? like ones from wp-rest or wp-json ?
Hi, I got this answer from the plugin owner:
“In response to the question of which type of API we use, wp-rest or wp-json, I cannot provide an answer as these are not standard terms that I or our team can respond to. You need to ask your developer to rephrase the question.”
Can you elaborate?
Thanks
when you say “api error” , where/how/what exactly is the error ?
Hi when the customer are in the checkout.
You do see the message in this picture: https://ibb.co/25qKQm6
All the customer then receive the same message and no one are able to do any payment/checkout.
The only way to get rid of the message are to purge all cache.
The plugin owner say we need to make sure that the files below should not be cached. At the moment I only excluded “checkout” page in the plugin, but that does not seems to work.
- wp-content/plugins/collector-checkout-for-woocommerce/assets/js/walley-checkout-for-woocommerce.js
- wp-content/plugins/collector-checkout-for-woocommerce/assets/css/style.css
- Files from https://checkout-uat.collector.se
- Files from https://checkout.collector.se
- Files from https://checkout.walleypay.com
- Files from https://checkout-api.collector.se
- Files from https://ecommerce.collector.se
- Files from https://api.walleypay.com
Please help
-
This reply was modified 2 years, 5 months ago by
Andreas.
I did see that I used:
“Private Cached URIs” to exclude cache added to the main site in the netwrk (xxxxxx.com). I have now also added the same for the individual sites /sv etc. Maybe this will prevent it to be cache the API error?
on the checkout and cart page , nothing is cached by our plugin
if you disable plugin , does it work ?
Hi,
It does not happen when your plugin is inactivated. And when the warning arise (happens maybe once/twice per month, it dissapear first after the cache from your plugin is purged. So in someway it is connected to LSCache. Can we make sure someway, that is does not save the cache. Maybe add cache control headers in htaccess, functions.php or similar?
Hi,
It seems to be caused by Object Cache. When I had the error I tryed to empty only that, and it worked again.
Is there any settings there I can use that cause this? I just did set Object cache to off. But I guess it is better to have it on if I can just adjust the correct settings.
Can I add something under “Do Not Cache Groups” that it does not save the API responses? Any other ideas?
well, I think that is the thing you should ask the API dev , if they use object cache and with group
Hi,
They use set_transient in the payment to temporarily save the transient, the response should then be valid for 60 min. In this case when they use get_transient the cache has saved the transient as valid after 60 min. It is then first when I purge the object cache as it works again.
Since they are using the standard WordPress set_transient and get_transient, do you know if this can be excluded to be saved as object cache and what group I then can use?
They use the functions below for set_transient and get_transient
/** * Save Walley order data to transient in WordPress. * * @param array $walley_order the returned Walley order data. * @return void */ function walley_save_order_data_to_transient( $walley_order ) { $walley_order_status_data = array( 'status' => $walley_order['status'] ?? '', 'total_amount' => $walley_order['total_amount'] ?? '', 'currency' => $walley_order['currency'] ?? '', ); set_transient( "walley_order_status_{$walley_order['order_id']}", $walley_order_status_data, 30 ); }and
* Get the access token from Walley. * * @return string */ private function get_access_token() { $access_token = get_transient( 'walley_checkout_access_token' ); if ( $access_token ) { return $access_token; } $response = CCO_WC()->api->get_access_token(); if ( is_wp_error( $response ) ) { return ''; } $access_token = $response['token_type'] . ' ' . $response['access_token']; set_transient( 'walley_checkout_access_token', $access_token, absint( $response['expires_in'] ) ); return $access_token; }Thank you for your support, I wish a good continuation on 2024:)
Hi again,
From what I can read, transients does not have groups. So Im not sure how I can make sure that is not saved longer than is set.
have you tried to set “Store Transients” OFF in object cache setting page?
Did not think about that function. I did just put it to off and activated the object cache again, I will follow up and see if that do the trick.
Thanks for your support.
Happy new year!
The topic ‘API error saves as cache at checkout’ is closed to new replies.