400, 'body' => 'FAIL']; } if (!is_array($payload) || !isset($payload['notify_id']) || !is_string($payload['notify_id']) || trim($payload['notify_id']) === '') { return ['http_status' => 400, 'body' => 'FAIL']; } try { $verified = $client->verifyNotification($payload, $platformPublicKey); } catch (Throwable $e) { $verified = false; } if (!$verified) { return ['http_status' => 401, 'body' => 'FAIL']; } try { if ($handleBusiness($payload) !== true) { return ['http_status' => 503, 'body' => 'FAIL']; } } catch (Throwable $e) { return ['http_status' => 503, 'body' => 'FAIL']; } return ['http_status' => 200, 'body' => 'SUCCESS']; }