endpoint = rtrim($endpoint, '/'); $this->merchant_id = $merchant_id; $this->secret_key = $secret_key; } public function createPaymentURL(PayableEntity $payable, array $options = []): string { $detail = $payable->getBillDescription(); $amount = $payable->getBillAmount(); $order_id = $payable->getBillId(); $detail = preg_replace('/[^A-Z0-9,\-_]/i', '_', $detail); $amount = sprintf('%0.2f', $amount); $hash = md5($this->secret_key.$detail.$amount.$order_id); return "$this->endpoint/payment/$this->merchant_id?'". http_build_query(compact('detail', 'order_id', 'amount', 'hash')); } public function verifyGatewayReturn(Request $request): bool { return true; } public function verifyGatewayCallback(Request $request, Response &$response = null): bool { $response = Res::make('OK'); return true; } }