PayU-EMEA / openpayu_php

OpenPayu SDK
http://developers.payu.com
Apache License 2.0
187 stars 86 forks source link

Not getting data in OrderNotify after payment #119

Open prithivi-byte opened 3 years ago

prithivi-byte commented 3 years ago

After completion of payment process, not getting any data in OrderNotify.php .While checking the code found that issue $_SERVER['REQUEST_METHOD'] is GET but it shot be POST method.How to change it or why its get method coming suddenly?Pleaase help me to fix it.

if ($_SERVER['REQUEST_METHOD'] == 'POST') { $body = file_get_contents('php://input'); $data = trim($body);

try {
    if (!empty($data)) {
        $result = OpenPayU_Order::consumeNotification($data);
    }

    if ($result->getResponse()->order->orderId) {

        /* Check if OrderId exists in Merchant Service, update Order data by OrderRetrieveRequest */
        $order = OpenPayU_Order::retrieve($result->getResponse()->order->orderId);
        if($order->getStatus() == 'SUCCESS'){
            //the response should be status 200
            header("HTTP/1.1 200 OK");
        }
    }
} catch (OpenPayU_Exception $e) {
    echo $e->getMessage();
}

}

WeTruck commented 3 years ago

I'm also getting it. Any fix?