From 0de4b4229d211d62f630ea6f7e88574ea5cefbf8 Mon Sep 17 00:00:00 2001 From: Petrica Chiriac Date: Tue, 7 Jul 2026 19:02:58 +0300 Subject: [PATCH 1/2] Add request/response parameters to support APM payments e.g. PIX --- src/GatewayRequest.php | 15 +++++++++++++++ src/GatewayResponse.php | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/GatewayRequest.php b/src/GatewayRequest.php index 712d6af..be018f4 100644 --- a/src/GatewayRequest.php +++ b/src/GatewayRequest.php @@ -775,6 +775,21 @@ static function APPLE_PAY_TOKEN() return "APPLEPAYTOKEN"; } + static function PAY_TYPE() + { + return "payType"; + } + + static function PAY_VALIDITY() + { + return "payValidity"; + } + + static function PAY_DESCRIPTION() + { + return "payDescription"; + } + static function PAY_TOKEN() { return "payToken"; diff --git a/src/GatewayResponse.php b/src/GatewayResponse.php index ed6980f..d4214c1 100644 --- a/src/GatewayResponse.php +++ b/src/GatewayResponse.php @@ -494,6 +494,26 @@ static function MERCHANT_ADVICE_CODE() return "merchantAdviceCode"; } + static function PAY_TYPE() + { + return "payType"; + } + + static function PAY_STATUS() + { + return "payStatus"; + } + + static function PAY_CODE() + { + return "payCode"; + } + + static function PAY_QR_CODE() + { + return "payQrCode"; + } + static function PAYMENT_LINK_URL() { return "PAYMENT_LINK_URL"; From ca8523c4a1b056087a50a5771ede838d26ed9550 Mon Sep 17 00:00:00 2001 From: Petrica Chiriac Date: Thu, 30 Jul 2026 20:24:48 +0300 Subject: [PATCH 2/2] Add PerformPayInit method in PHP SDK. --- src/GatewayService.php | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/GatewayService.php b/src/GatewayService.php index 3be3ac3..77f10dc 100644 --- a/src/GatewayService.php +++ b/src/GatewayService.php @@ -144,6 +144,25 @@ function PerformPurchase(GatewayRequest $request, GatewayResponse $response) return $this->PerformConfirmation($request, $response); } +////////////////////////////////////////////////////////////////////// +// PerformPayInit() - Perform an asynchronous payment initiation +// where the final response comes later. +////////////////////////////////////////////////////////////////////// +// + function PerformPayInit(GatewayRequest $request, GatewayResponse $response) + { + $request->Set(GatewayRequest::TRANSACTION_TYPE(), "PAY_INIT"); + if ($request->Get(GatewayRequest::REFERENCE_GUID()) != null) { + if (!($this->PerformTargetedTransaction($request, $response))) { + return false; + } + } else { + if (!($this->PerformTransaction($request, $response))) { + return false; + } + } + return $this->PerformConfirmation($request, $response); + } ////////////////////////////////////////////////////////////////////// // @@ -482,6 +501,11 @@ function PerformTransaction(GatewayRequest $request, GatewayResponse $response) $request->Set("gatewayServlet", $urlBits['path'] . "?" . $urlBits['query']); } + // echo "\ngatewayServer=" . $request->Get("gatewayServer"); + // echo "\ngatewayProtocol=" . $request->Get("gatewayProtocol"); + // echo "\ngatewayPortNo=" . $request->Get("gatewayPortNo"); + // echo "\ngatewayServlet=" . $request->Get("gatewayServlet"); + // // If the request specifies a server name, use it. // Otherwise, use the default for the service. @@ -775,6 +799,12 @@ function PerformCURLTransaction($host, GatewayRequest $request, GatewayResponse $urlPortNo = $this->rocketGatePortNo; } + if (substr($urlServlet, 0, 1) == "/") { + + $urlServlet = substr($urlServlet, 1); + + } + // // Build the URL for the gateway service. // @@ -831,7 +861,7 @@ function PerformCURLTransaction($host, GatewayRequest $request, GatewayResponse // curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, FALSE); // ////////////////////////////////////////////////////////////////////// - + // echo "URL=" . $url; // // Setup the call to the URL. //