PayU与PHP集成-通知脚本不起作用

时间:2019-07-28 10:24:10

标签: php payment-gateway payu

这是我的文件OrderNotify.php(从payu文档下载)

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();
    }
}

在我检查状态为成功后,我想更新数据库中的一行,但是行不通。是因为我正在使用沙箱帐户吗?

0 个答案:

没有答案