-
Notifications
You must be signed in to change notification settings - Fork 86
/
OrderNotify.php
35 lines (29 loc) · 988 Bytes
/
OrderNotify.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* OpenPayU Examples
*
* @copyright Copyright (c) PayU
* http://www.payu.com
* http://developers.payu.com
*/
require_once realpath(dirname(__FILE__)) . '/../../../lib/openpayu.php';
require_once realpath(dirname(__FILE__)) . '/../../config.php';
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();
}
}