Make plugin return HTTP 200 OK on POST

I am developing a custom plugin – payment gateway – which returns me data through POST request. The payment gateway is expecting this response:

HTTP/1.1 200 OK
Content-Type: application/x-www-form-urlencoded; charset=utf-8


So, in early stages of development, I decided to try if I am able to communicate at all:


function say_ok_to_everything(){
//I want to say OK only when getting request from the payment gateway
if( isset( $_REQUEST[‘listener’] ) && $_REQUEST[‘listener’] == ‘my-listener’ ) {
echo ‘code=0&message=OK’;
//not sure if I should end script here

If I look to my access log, I see this:

“POST /?listener=my-listener HTTP/1.1” 404 16843 “-” “Zend_Http_Client”

If I directly access my site through URL I see this in the log: – – [29/Jul/2019:09:50:43 +0000] “GET /?listener=my-listener HTTP/1.1” 200 8698 “-” “Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36”

So, in other words, on POST, the site returns HTTP error 404, on GET it returns HTTP 200 OK. How do I convince the site to return 200 on both?

BTW, from the logs on payment gateway, I can see, that the code=0&message=OK was returned in both ways

Thanks a lot

Read more here:: Make plugin return HTTP 200 OK on POST

Leave a Reply

Your email address will not be published. Required fields are marked *