Error in code returning 500 error instead of 200
-
I have found a problem with the plugin that is causing the CC Bill servers to keep resending approval postbacks.
Looking at wc-gateway-ccbill.php
For example in function process_ccbill_approval_post()
Line 528 reads
wp_die('Success', array( 'response' => 200 ) );
This is supposed to send an error 200 but the second parameter of wp_die is $title as per WP Function Reference. This means instead error 500 is returned instead of 200 as desired.
You need to update all your wp_die calls to be something like
wp_die('Success', 'CC Bill Payment Gateway', array( 'response' => 200 ) );
This will return the correct 200 header and mean the many replicated postbacks will stop.Also can I suggest changing line 526 to include the transaction ID which helps shop owners find subscriptions more easily…
$order->add_order_note( __( 'PDT payment completed - '.$txId, 'woocommerce' ) );
Thank you very much and I hope this helps other users.
- The topic ‘Error in code returning 500 error instead of 200’ is closed to new replies.