require_once './orderInfo.php'; require_once '../UnitPay.php'; $unitPay = new UnitPay($secretKey); try { // Validate request (check ip address, signature and etc) $unitPay->checkHandlerRequest(); list($method, $params) = array($_GET['method'], $_GET['params']); // Very important! Validate request with your order data, before complete order if ($params['orderSum'] != $orderSum || $params['orderCurrency'] != $orderCurrency || $params['account'] != $orderId || $params['projectId'] != $projectId) { // logging data and throw exception throw new InvalidArgumentException('Order validation Error!'); } switch ($method) { // Just check order (check server status, check order in DB and etc) case 'check': print $unitPay->getSuccessHandlerResponse('Check Success. Ready to pay.'); break; // Method Pay means that the money received // Method Pay means that the money received case 'pay': // Please complete order print $unitPay->getSuccessHandlerResponse('Pay Success'); break; // Method Error means that an error has occurred. // Method Error means that an error has occurred. case 'error': // Please log error text. print $unitPay->getSuccessHandlerResponse('Error logged'); break; // Method Refund means that the money returned to the client // Method Refund means that the money returned to the client