WooCommerce cancels pending order before Pay360 (Access PaySuite) payment callback arrives — order Cancelled but payment taken
WooCommerce Cancels Deferred Order Before Pay360 (Access PaySuite) Returns Payment Confirmation ## Introduction Our users occasionally encounter an issue where an order on WooCommerce is automatically canceled before Pay360...


WooCommerce Cancels Deferred Order Before Pay360 (Access PaySuite) Returns Payment Confirmation
Introduction
Our users occasionally encounter an issue where an order on WooCommerce is automatically canceled before Pay360 (Access PaySuite) provides confirmation of a completed payment. In this article, we will discuss the possible causes of this problem and potential solutions.
Problem Description
When a customer starts placing an order and proceeds to the Pay360 page for payment, they may not complete the process immediately. In such cases, WooCommerce automatically cancels the order after a set time interval, which is usually 12 hours. However, after this time, the customer might still complete the payment through Pay360, but due to a delay in returning information about the completed payment, WooCommerce does not update the order status and leaves it in a canceled state.
In one case, the customer switched to PayPal within Pay360 and completed the payment after the time limit expired, leading to the order being canceled.
Cause Analysis
The possible cause lies in the conflict between WooCommerce's automatic order cancellation and the delay in returning information from Pay360. It's likely that the WooCommerce system cancels the order before Pay360 provides confirmation of the completed payment.
Current Time Interval
The default hold period in WooCommerce is 12 hours. This value was not reached until the payment was completed, indicating a problem with the return of information from Pay360.
Solution
1. Extend Hold Time Interval
One solution could be to increase the hold time interval to a longer duration, giving more time for Pay360 to provide information about the completed payment.
Example Code:
add_filter('woocommerce_payment_gateway_stock_hold_time', 'custom_stock_hold_time', 10, 2);
function custom_stock_hold_time($stock_hold_time, $payment_method_id) {
if ($payment_method_id == 'pay360') {
return 48; // Increase hold time to 48 hours
}
return $stock_hold_time;
}
2. Check and Configure Information Return from Pay360
Another possibility is to check and configure the information return from Pay360. There might be issues with settings or data transmission speed.
Example Code for Setting Timeout:
add_filter('woocommerce_gateway_timeout', 'custom_gateway_timeout');
function custom_gateway_timeout($timeout) {
return 300; // Increase timeout to 5 minutes
}
3. Add Logging
Adding logging will help identify problems with information return from Pay360. This will allow tracking moments when the information was not timely provided.
Example Code for Adding Logging:
add_action('woocommerce_api_' . WC()->session->get('chosen_payment_method'), 'log_gateway_response');
function log_gateway_response($data) {
error_log(print_r($data, true));
}
Conclusion
The problem of canceling an order on WooCommerce before receiving information about a completed payment via Pay360 can be resolved by extending the hold time interval or configuring the information return from the payment gateway. It is also recommended to add logging to track issues.