Error When Checking Out with WooCommerce Plugin


#1

The plugin has worked well, but of late when used with the Invoice Payment for WooCommerce Plugin the plugin has begun to run into a fatal error whereas using it with WooCommerce natively, it has no problems. The issue was first encountered on Version 1.3.0 of this PayNow plugin. Updating it to Version 1.3.3 has not solved the issue.

The Invoice Payment for WooCommerce Plugin had not been updated since install and updating it has also not solved this issue.

Here are the details of the error.

Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /public_html/wp-content/plugins/Paynow-for-WooCommerce-master/includes/class-wc-gateway-non-block-paynow.php:517
Stack trace:
#0 /public_html/wp-includes/class-wp-hook.php(308): WC_Gateway_Paynow->receipt_page()
#1 /public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#2 /public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#3 /public_html/wp-content/plugins/woocommerce/templates/checkout/order-receipt.php(44): do_action()
#4 /public_html/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include('/home/userprofile0...')
#5 /public_html/wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php(243): wc_get_template()
#6 /public_html/wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php(59): WC_Shortcode_Checkout::order_pay()
#7 /public_html/wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php(72): WC_Shortcode_Checkout::output()
#8 /public_html/wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php(95): WC_Shortcodes::shortcode_wrapper()
#9 /public_html/wp-includes/shortcodes.php(355): WC_Shortcodes::checkout()
#10 [internal function]: do_shortcode_tag()
#11 /public_html/wp-includes/shortcodes.php(227): preg_replace_callback()
#12 /public_html/wp-includes/class-wp-hook.php(308): do_shortcode()
#13 /public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#14 /public_html/wp-includes/post-template.php(255): apply_filters()
#15 /public_html/wp-content/themes/rishi/template-parts/content-page.php(45): the_content()
#16 /public_html/wp-includes/template.php(785): require('/home/userprofile0...')
#17 /public_html/wp-includes/template.php(718): load_template()
#18 /public_html/wp-includes/general-template.php(204): locate_template()
#19 /public_html/wp-content/themes/rishi/page.php(29): get_template_part()
#20 /public_html/wp-includes/template-loader.php(106): include('/home/userprofile0...')
#21 /public_html/wp-blog-header.php(19): require_once('/home/userprofile0...')
#22 /public_html/index.php(17): require('/home/userprofile0...')
#23 {main}
thrown in /public_html/wp-content/plugins/Paynow-for-WooCommerce-master/includes/class-wc-gateway-non-block-paynow.php on line 517

#2

Good day

Kindly use this link to download the Addon that addresses your issue


#3

Thanks for your response @elphas. I installed it on one of the sites and now there is no Fatal Error, but I I don’t get redirected to PayNow. I just get this page:

The URL https://mysite.com/?page_id=11&order-pay=xxxx&key=wc_order_xxxxxxxxxxxxxx is no longer returning an error. Only the redirection remains. This site is still under maintenance using in integration that’s still in testing. I will give my feedback from another site that had the WooCommerce Paynow plugin working before this bug showed up.


#4

Since your integration is in test mode, Can you make sure you are using your Paynow registered email address as your Paynow Email on checkout.


#5

I am using my PayNow login email for checking out.

In the site where the integration is live, I am no longer getting a fatal error but the page also stalls on this screen without redirecting to PayNow:


#6

I have tried to display values at the point the code is exiting in class-wc-gateway-non-block-paynow.php in the following block:

// send API post request
$response = wp_remote_request($url, $response_fields);
if ( is_wp_error( $response ) ) {
    // Code is exiting in this condition
}

I used this code:

var_dump($response);
echo "URL: " . $url;
echo "Response Fields: " . print_r($response_fields, true);

I got the following output:

object(WP_Error)#9728 (3) { ["errors"]=> array(1) { ["http_request_failed"]=> array(1) { [0]=> string(48) "cURL error 28: Connection timeout after 10000 ms" } } ["error_data"]=> array(0) { } ["additional_data":protected]=> array(0) { } }

URL: https://www.paynow.co.zw/Interface/InitiateTransaction

Response Fields: Array ( [timeout] => 45 [method] => POST [body] => resulturl=https%3A%2F%2Fmydomain.co.zw%2Fwc-api%2Fwc_gateway_paynow%2F%3Forder_id%3D2036&returnurl=https%3A%2F%2Fmydomain.co.zw%2Fcheckout%2Forder-received%2F2036%2F%3Fkey%3Dwc_order_BjbcdZF7CTl2Y&reference=Order+Number%3A+2036&amount=860.00&id=1680&additionalinfo=&authemail=info%40mydomain.co.zw&status=Message&hash=HASH )

Note: I have concealed my domain and hash in the output above.


#7

On further investigating I discovered that all my sites under a particular shared hosting server 154.49.245.111 cannot reach www.paynow.co.zw. Even on SSH I cannot even ping or curl the domain. I am investigating the issue from my server but would also like to find out if for any reason paynow.co.zw would block any traffic from a particular IP?

[Update] This is a screenshot from Hostinger support in which they say 196.44.182.165, is not blocked from their side.


#8

Is there a solution to this blocking issue?