### Install GPWebPay Core via Composer Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/installation.md Use this command to add the library as a dependency to your project. ```bash composer require pixidos/gpwebpay-core ``` -------------------------------- ### Install GPWebPay Core via Composer Source: https://github.com/pixidos/gpwebpay-core/blob/main/readme.md Use this command to add the library as a dependency to your PHP project. ```sh $ composer require pixidos/gpwebpay-core ``` -------------------------------- ### Create Signed Payment Request Source: https://context7.com/pixidos/gpwebpay-core/llms.txt Generates a signed request from an Operation object, supporting both GET redirect links and POST form submissions. ```php getPaymentConfigProvider(), $signerProvider ); // Create signed request from operation $request = $requestFactory->create($operation); // Option 1: Redirect link (GET method) $paymentUrl = $request->getRequestUrl(); echo sprintf('Pay Now', $paymentUrl); // Option 2: Form submission (POST method) $formActionUrl = $request->getRequestUrl(true); // true = URL without params ?>
getParams() as $param): ?>
``` -------------------------------- ### Create Payment Request and Render Link Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/example.md Initializes the necessary services and creates a payment request object, then generates a URL for the client to initiate the payment. ```php create( [ ConfigFactory::PRIVATE_KEY => __DIR__ . '/_certs/test.pem', ConfigFactory::PRIVATE_KEY_PASSPHRASE => '1234567', ConfigFactory::PUBLIC_KEY => __DIR__ . '/_certs/test-pub.pem', ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do', ConfigFactory::MERCHANT_NUMBER => '123456789', ConfigFactory::DEPOSIT_FLAG => 1, ConfigFactory::RESPONSE_URL => 'http://example.com/proccess-gpw-response', ], ); $signerProvider = new SignerProvider(new SignerFactory(), $config->getSignerConfigProvider()); $requestFactory = new RequestFactory($config->getPaymentConfigProvider(), $signerProvider); $responseFactory = new ResponseFactory($config->getPaymentConfigProvider()); // create Request $operation = new Operation( orderNumber: new OrderNumber(time()), amount: new AmountInPennies(10000), currency: new Currency(CurrencyEnum::CZK()), ); $operation->addParam(new PayMethods(PayMethod::CARD(), PayMethod::GOOGLE_PAY())); // allowed payment types $operation->addParam(new MerOrderNum('12345678')); // Reference number $request = $requestFactory->create($operation); // render html button for clinet echo sprintf('This is pay link', $request->getRequestUrl()); ``` -------------------------------- ### Instantiate SignerProvider Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/services.md Initializes the SignerProvider using a SignerFactory and the signer configuration provider. ```php use Pixidos\GPWebPay\Signer\SignerFactory; use Pixidos\GPWebPay\Signer\SignerProvider; $signerProvider = new SignerProvider(new SignerFactory(), $config->getSignerConfigProvider()); ``` -------------------------------- ### Response Creation and Processing Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/response.md Demonstrates how to create a response object from incoming parameters and process it either manually or using the ResponseProvider with callbacks. ```APIDOC ## Create and Process Response ### Description This section covers the creation of a response object from incoming GET or POST parameters and provides two methods for processing this response: manual verification and processing, or using the `ResponseProvider` with success and error callbacks. ### Method Not applicable (server-side processing) ### Endpoint Not applicable ### Parameters #### Request Body - **params** (array) - Required - An array containing response parameters, typically from `$_GET` or `$_POST`. ### Request Example ```php $params = $_GET; // or $_POST depends on how you send request $response = $responseFactory->create($params); ``` ### Response #### Success Response (200) - **ResponseInterface** - An object representing the processed response. #### Response Example ```php // Manual Processing if (!$provider->verifyPaymentResponse($response)) { // invalid verification } if ($response->hasError()) { // here is you code for processing response error } // here is you code for processing response // Using ResponseProvider and Callbacks $provider ->addOnSuccess( static function (ResponseInterface $response) { // here is your code for processing response } ) ->addOnSuccess( static function (ResponseInterface $response) { // here is your another code for processing response } ); $provider->addOnError( static function (GPWebPayException $exception, ResponseInterface $response) { // here is you code for processing error } ); $provider->provide($response); ``` ``` -------------------------------- ### Create Multiple Gateway Configurations Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/configuration.md Configure multiple GPWebPay gateways, each potentially for a different currency. Specify a default gateway to be used if not explicitly chosen. Ensure paths to certificates and URLs are correct for each gateway. ```php use Pixidos\GPWebPay\Config\Factory\ConfigFactory; use Pixidos\GPWebPay\Config\Factory\PaymentConfigFactory; $configFactory = new ConfigFactory(new PaymentConfigFactory()); $config = $configFactory->create( [ 'czk' => [ ConfigFactory::PRIVATE_KEY => __DIR__ . '/_certs/test.pem', ConfigFactory::PRIVATE_KEY_PASSPHRASE => '1234567', ConfigFactory::PUBLIC_KEY => __DIR__ . '/_certs/test-pub.pem', ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do', ConfigFactory::MERCHANT_NUMBER => '123456789', ConfigFactory::DEPOSIT_FLAG => 1, ], 'eur' => [ ConfigFactory::PRIVATE_KEY => __DIR__ . '/_certs/test2.pem', ConfigFactory::PRIVATE_KEY_PASSPHRASE => '12345678', ConfigFactory::PUBLIC_KEY => __DIR__ . '/_certs/test-pub2.pem', ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do', ConfigFactory::MERCHANT_NUMBER => '123456780', ConfigFactory::DEPOSIT_FLAG => 1, ], ], 'czk' // what gateway is default ); ``` -------------------------------- ### Initialize Payment Request Source: https://context7.com/pixidos/gpwebpay-core/llms.txt Configures the payment service and redirects the user to the GPWebPay gateway. Requires valid certificate paths and merchant credentials. ```php create([ ConfigFactory::PRIVATE_KEY => __DIR__ . '/certs/merchant.pem', ConfigFactory::PRIVATE_KEY_PASSPHRASE => getenv('GPWEBPAY_PASSPHRASE'), ConfigFactory::PUBLIC_KEY => __DIR__ . '/certs/gpwebpay.pem', ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do', ConfigFactory::MERCHANT_NUMBER => getenv('GPWEBPAY_MERCHANT'), ConfigFactory::DEPOSIT_FLAG => 1, ConfigFactory::RESPONSE_URL => 'https://yoursite.com/payment_callback.php', ]); // Setup services $signerProvider = new SignerProvider(new SignerFactory(), $config->getSignerConfigProvider()); $requestFactory = new RequestFactory($config->getPaymentConfigProvider(), $signerProvider); // Create payment operation (example: 299.90 CZK) $operation = new Operation( orderNumber: new OrderNumber(time() . random_int(1000, 9999)), amount: new AmountInPennies(29990), // 299.90 in hellers currency: new Currency(CurrencyEnum::CZK()) ); $operation->addParam(new MerOrderNum('ORDER-' . date('Ymd-His'))); $operation->addParam(new PayMethods(PayMethod::CARD(), PayMethod::GOOGLE_PAY())); // Create and redirect $request = $requestFactory->create($operation); header('Location: ' . $request->getRequestUrl()); exit; ``` -------------------------------- ### Instantiate ResponseProvider Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/services.md Initializes the ResponseProvider to validate and process gateway responses. ```php use Pixidos\GPWebPay\ResponseProvider; $provider = new ResponseProvider( $config->getPaymentConfigProvider(), $signerProvider ); ``` -------------------------------- ### Configure Multiple GPWebPay Gateways Source: https://context7.com/pixidos/gpwebpay-core/llms.txt Set up configurations for multiple payment gateways, potentially for different currencies, using the ConfigFactory. A default gateway can also be specified. ```php create( [ 'czk' => [ ConfigFactory::PRIVATE_KEY => '/path/to/merchant-czk.pem', ConfigFactory::PRIVATE_KEY_PASSPHRASE => 'passphrase-czk', ConfigFactory::PUBLIC_KEY => '/path/to/gpwebpay-public.pem', ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do', ConfigFactory::MERCHANT_NUMBER => '123456789', ConfigFactory::DEPOSIT_FLAG => 1, ], 'eur' => [ ConfigFactory::PRIVATE_KEY => '/path/to/merchant-eur.pem', ConfigFactory::PRIVATE_KEY_PASSPHRASE => 'passphrase-eur', ConfigFactory::PUBLIC_KEY => '/path/to/gpwebpay-public-eur.pem', ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do', ConfigFactory::MERCHANT_NUMBER => '987654321', ConfigFactory::DEPOSIT_FLAG => 1, ], ], 'czk' // default gateway ); ``` -------------------------------- ### Initialize SignerProvider for GPWebPay Source: https://context7.com/pixidos/gpwebpay-core/llms.txt Initialize the SignerProvider with a SignerFactory and the gateway's signer configuration. This provider is used internally for signing requests and verifying responses. ```php getSignerConfigProvider() ); // The signer provider is used internally by RequestFactory and ResponseProvider // to sign requests and verify response signatures automatically ``` -------------------------------- ### Create and Render Request Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/request.md Generates a request via the factory and renders it as a link or a POST form. ```php $request = $requestFactory->create($operation); ``` ```php echo sprintf('This is pay link', $request->getRequestUrl()); ``` ```php
getParams() as $param) { echo sprintf('%s', $param->getValue(), $param->getParamName(), "\n\r"); } ?>
``` -------------------------------- ### Create Operation Object Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/request.md Initializes an Operation object with required order details, currency, and optional gateway or response URL settings. ```php use Pixidos\GPWebPay\Data\Operation; use Pixidos\GPWebPay\Enum\Operation as OperationEnum; use Pixidos\GPWebPay\Param\Currency; use Pixidos\GPWebPay\Enum\Currency as CurrencyEnum; use Pixidos\GPWebPay\Param\AmountInPennies; use Pixidos\GPWebPay\Param\OrderNumber; $operation = new Operation( orderNumber: new OrderNumber(self::ORDER_NUMBER), amount: new AmountInPennies(10000), currency: new Currency(CurrencyEnum::CZK()), gateway: 'czk', // optional, if you leave it blank, the default settings will be used (only since version ^2.4.0) for lower versions you have to set it. responseUrl: new ResponseUrl('http://example.com/proccess-gpw-response'), // optional when you setup in config operation: OperationEnum::CREATE_ORDER() // optional CREATE_ORDER() is default, other options are CARD_VERIFICATION() or FINALIZE_ORDER() ); ``` -------------------------------- ### Configure Single GPWebPay Gateway Source: https://context7.com/pixidos/gpwebpay-core/llms.txt Create a configuration object for a single payment gateway using the ConfigFactory. Ensure all required paths, credentials, and URLs are provided. ```php create([ ConfigFactory::PRIVATE_KEY => '/path/to/merchant.pem', ConfigFactory::PRIVATE_KEY_PASSPHRASE => 'your-passphrase', ConfigFactory::PUBLIC_KEY => '/path/to/gpwebpay-public.pem', ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do', ConfigFactory::MERCHANT_NUMBER => '123456789', ConfigFactory::DEPOSIT_FLAG => 1, // 1 = instant payment required ConfigFactory::RESPONSE_URL => 'https://yoursite.com/payment/callback' ]); ``` -------------------------------- ### Create Single Gateway Configuration Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/configuration.md Use this to create a configuration for a single GPWebPay gateway. Ensure all required attributes like private key, public key, URL, and merchant number are provided. ```php use Pixidos\GPWebPay\Config\Factory\ConfigFactory; use Pixidos\GPWebPay\Config\Factory\PaymentConfigFactory; $configFactory = new ConfigFactory(new PaymentConfigFactory()); $config = $configFactory->create( [ ConfigFactory::PRIVATE_KEY => __DIR__ . '/_certs/test.pem', ConfigFactory::PRIVATE_KEY_PASSPHRASE => '1234567', ConfigFactory::PUBLIC_KEY => __DIR__ . '/_certs/test-pub.pem', ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do', ConfigFactory::MERCHANT_NUMBER => '123456789', ConfigFactory::DEPOSIT_FLAG => 1, ConfigFactory::RESPONSE_URL => 'http://example.com/proccess-gpw-response' ] ); ``` -------------------------------- ### Create Response Object Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/response.md Initializes a response object using the ResponseFactory from incoming request parameters. ```php $params = $_GET; // or $_POST depends on how you send request $response = $responseFactory->create($params); ``` -------------------------------- ### Instantiate ResponseFactory Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/services.md Initializes the ResponseFactory for creating Response objects from received parameters. ```php use Pixidos\GPWebPay\Factory\ResponseFactory; $responseFactory = new ResponseFactory($config->getPaymentConfigProvider()); ``` -------------------------------- ### Register Callbacks for Response Handling Source: https://context7.com/pixidos/gpwebpay-core/llms.txt Use ResponseProvider to register success and error callbacks. Callbacks are triggered automatically when the provide method is called. ```php getPaymentConfigProvider(), $signerProvider ); // Register success callbacks (can add multiple) $responseProvider->addOnSuccess(function (ResponseInterface $response) { // Payment successful - update order status $orderId = $response->getMerOrderNumber(); // updateOrderStatus($orderId, 'paid'); error_log(sprintf( 'Payment successful: Order %s, Gateway Order: %s', $response->getMerOrderNumber(), $response->getOrderNumber() )); }); // Register error callback $responseProvider->addOnError(function (GPWebPayException $exception, ResponseInterface $response) { // Payment failed or verification error if ($exception instanceof GPWebPayResultException) { // Payment was rejected by gateway error_log(sprintf( 'Payment rejected: PR=%d, SR=%d, Text=%s', $exception->getPrcode(), $exception->getSrcode(), $exception->getResultText() )); } else { // Signature verification failed error_log('Payment verification failed: ' . $exception->getMessage()); } }); // Process the response (triggers appropriate callbacks) $response = $responseFactory->create($_GET); $responseProvider->provide($response); ``` -------------------------------- ### Response Processing with Callbacks Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/response.md Uses the ResponseProvider to register success and error callbacks for automated response handling. ```php // success callbacks $provider ->addOnSuccess( static function (ResponseInterface $response) { // here is your code for processing response } ) ->addOnSuccess( static function (ResponseInterface $response) { // here is your another code for processing response } ); // error callback $provider->addOnError( static function (GPWebPayException $exception, ResponseInterface $response) { // here is you code for processing error } ); // and next step is call $provider->provide($response); ``` -------------------------------- ### Instantiate RequestFactory Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/services.md Creates a RequestFactory instance to facilitate the creation of Request objects. ```php use Pixidos\GPWebPay\Factory\RequestFactory; $requestFactory = new RequestFactory($config->getPaymentConfigProvider(), $signerProvider); ``` -------------------------------- ### Handle Payment Callback Source: https://context7.com/pixidos/gpwebpay-core/llms.txt Processes the response from the gateway and executes success or error handlers. Ensure the response URL matches the one provided during initialization. ```php create([ ConfigFactory::PRIVATE_KEY => __DIR__ . '/certs/merchant.pem', ConfigFactory::PRIVATE_KEY_PASSPHRASE => getenv('GPWEBPAY_PASSPHRASE'), ConfigFactory::PUBLIC_KEY => __DIR__ . '/certs/gpwebpay.pem', ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do', ConfigFactory::MERCHANT_NUMBER => getenv('GPWEBPAY_MERCHANT'), ConfigFactory::DEPOSIT_FLAG => 1, ConfigFactory::RESPONSE_URL => 'https://yoursite.com/payment_callback.php', ]); $signerProvider = new SignerProvider(new SignerFactory(), $config->getSignerConfigProvider()); $responseFactory = new ResponseFactory($config->getPaymentConfigProvider()); $responseProvider = new ResponseProvider($config->getPaymentConfigProvider(), $signerProvider); // Setup handlers $responseProvider->addOnSuccess(function (ResponseInterface $response) { // Update database, send confirmation email, etc. $orderId = $response->getMerOrderNumber(); // DB::table('orders')->where('id', $orderId)->update(['status' => 'paid']); header('Location: /order/success?order=' . urlencode($orderId)); exit; }); $responseProvider->addOnError(function (GPWebPayException $e, ResponseInterface $response) { $orderId = $response->getMerOrderNumber(); // DB::table('orders')->where('id', $orderId)->update(['status' => 'failed']); header('Location: /order/failed?order=' . urlencode($orderId)); exit; }); // Process response $response = $responseFactory->create($_GET); $responseProvider->provide($response); ``` -------------------------------- ### Add Custom Parameters Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/request.md Extends the operation configuration by adding custom parameters using the addParam method. ```php $operation->addParam(new PayMethods(PayMethod::CARD(), PayMethod::GOOGLE_PAY())); ``` -------------------------------- ### Handle GPWebPay Response Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/example.md Configures response providers with success and error callbacks to process the payment result returned by the gateway. ```php create( [ ConfigFactory::PRIVATE_KEY => __DIR__ . '/_certs/test.pem', ConfigFactory::PRIVATE_KEY_PASSPHRASE => '1234567', ConfigFactory::PUBLIC_KEY => __DIR__ . '/_certs/test-pub.pem', ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do', ConfigFactory::MERCHANT_NUMBER => '123456789', ConfigFactory::DEPOSIT_FLAG => 1, ConfigFactory::RESPONSE_URL => 'http://example.com/proccess-gpw-response', ], ); $signerProvider = new SignerProvider(new SignerFactory(), $config->getSignerConfigProvider()); $responseFactory = new ResponseFactory($config->getPaymentConfigProvider()); $responseProvider = new ResponseProvider( $config->getPaymentConfigProvider(), $signerProvider ); // setup callbacks $responseProvider->addOnSuccess(function (\Pixidos\GPWebPay\Data\Response $response) { // do anything you need after payment is success echo 'Success'; }); // you can add more callbacks $responseProvider->addOnSuccess(function (\Pixidos\GPWebPay\Data\Response $response) { // do anything you need echo 'Success'; }); $responseProvider->addOnError(function (\Pixidos\GPWebPay\Exceptions\GPWebPayResultException $exception, \Pixidos\GPWebPay\Data\Response $response) { // do anything you need echo 'Success'; }); // process response from GPWebPay $response = $responseFactory->create($_GET); $responseProvider->provide($response); ``` -------------------------------- ### Define Payment Operation Source: https://context7.com/pixidos/gpwebpay-core/llms.txt Configures the payment order details including amount, currency, and allowed payment methods. The amount must be provided in the smallest currency unit (e.g., pennies or hellers). ```php addParam(new MerOrderNum('ORDER-2024-001')); // your actual order reference $operation->addParam(new PayMethods( PayMethod::CARD(), PayMethod::GOOGLE_PAY(), PayMethod::APPLE_PAY() )); // Available payment methods: // PayMethod::CARD() - Credit/Debit card // PayMethod::GOOGLE_PAY() - Google Pay // PayMethod::APPLE_PAY() - Apple Pay // PayMethod::MASTERPASS() - Masterpass // PayMethod::PLATBA24() - Platba24 // PayMethod::BANK_ACCOUNT() - Direct bank transfer // PayMethod::BANK_KB() - Komercni banka // PayMethod::BANK_CSOB() - CSOB // PayMethod::BANK_CS() - Ceska sporitelna // PayMethod::BANK_FIO() - Fio banka // ... and more Czech banks ``` -------------------------------- ### Response Parameters Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/response.md Details of the parameters available within the response object, including their types and descriptions. ```APIDOC ## Response Parameters ### Description This section details the various parameters available within the GPWebPay response object, which can be accessed using methods like `getResultText()`, `getPrcode()`, etc. ### Parameters #### ResultText - **return:** `string` - A text description of the error identified by a combination of PRCODE and SRCODE. The contents are coded using the Windows Central European (Code Page 1250). #### PrCode - **return:** `int` - Primary code. For details, see “List of return codes in GPWebPay doc”. #### SrCode - **return:** `int` - Secondary code. For details, see “List of return codes in GPWebPay doc”. #### OrderNumber - **return:** `string` - Contents of the field from the request. #### MerOrderNumber - **return:** `string` | `null` - Contents of the field from the request, if included. #### UserParam1 - **return:** `string` | `null` - Hash numbers of the payment card. Only if the merchant has this functionality enabled. #### Md - **return:** `string` | `null` - Any merchant’s data returned to the merchant in the response in the unchanged form. GPWebPay core use this field to store information about used gateway. #### Digest and Digest1 - **return:** `string` - *Digest* is a check signature of the string generated as a concatenation of all the fields sent in the given order. *Digest1* is same as *Digest* but (without the DIGEST field) and on the top of that also the MERCHANTNUMBER field. ### Request Example ```php $response->getResultText(); $response->getPrcode(); $response->getSrcode(); $response->getOrderNumber(); $response->getMerOrderNumber(); $response->getUserParam1(); $response->getMd(); $response->getDigest(); $response->getDigest1(); ``` ``` -------------------------------- ### Access Response Parameters Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/response.md Methods to retrieve specific data fields from the response object. ```php $response->getResultText(); ``` ```php $response->getPrcode(); ``` ```php $response->getSrcode(); ``` ```php $response->getOrderNumber(); ``` ```php $response->getMerOrderNumber(); ``` ```php $response->getUserParam1(); ``` ```php $response->getMd(); ``` ```php $response->getDigest(); $response->getDigest1(); ``` -------------------------------- ### Define Currency Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/request.md Sets the currency using ISO 4217 constants provided by the Currency enum. ```php use Pixidos\GPWebPay\Enum\Currency as CurrencyEnum; $currency = new Currency(CurrencyEnum::CZK()) ``` -------------------------------- ### Manually Verify Payment Response Signature Source: https://context7.com/pixidos/gpwebpay-core/llms.txt Manually verify the payment response signature using ResponseProvider::verifyPaymentResponse. This is useful for custom handling without callbacks. Ensure to handle invalid signatures by returning an appropriate HTTP error. ```php create($_GET); $responseProvider = new ResponseProvider( $config->getPaymentConfigProvider(), $signerProvider ); // Manually verify signature if (!$responseProvider->verifyPaymentResponse($response)) { // Invalid signature - possible tampering http_response_code(400); die('Invalid payment signature'); } // Check for payment errors if ($response->hasError()) { // Payment was not successful $errorCode = $response->getPrcode(); $errorDetail = $response->getSrcode(); $errorMessage = $response->getResultText(); // Handle specific error codes switch ($errorCode) { case 28: // Declined by issuer $userMessage = 'Your card was declined. Please try another card.'; break; case 30: // Transaction not permitted $userMessage = 'This transaction is not permitted.'; break; default: $userMessage = 'Payment failed. Please try again.'; } // Show error to user or redirect die($userMessage); } // Payment successful $orderId = $response->getMerOrderNumber(); // Mark order as paid in your system // redirect to thank you page ``` -------------------------------- ### Define AmountInPennies Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/request.md Specifies the payment amount in the smallest currency unit. ```php $amount = new AmountInPennies(100000); // represent 1000.00 Kč|Euro ``` -------------------------------- ### Manual Response Processing Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/response.md Manually verifies the response signature and checks for errors using the ResponseProvider. ```php // verify response signatures if (!$provider->verifyPaymentResponse($response)) { // invalid verification } // success verification if ($response->hasError()) { // here is you code for processing response error } // here is you code for processing response ``` -------------------------------- ### Parse Gateway Response Source: https://context7.com/pixidos/gpwebpay-core/llms.txt Processes the callback parameters from the payment gateway to verify the transaction result. ```php getPaymentConfigProvider()); // Create response from callback parameters (GET or POST) $response = $responseFactory->create($_GET); // or $_POST // Access response data $orderNumber = $response->getOrderNumber(); // Original order number from request $merOrderNum = $response->getMerOrderNumber(); // Your merchant order reference $prCode = $response->getPrcode(); // Primary return code (0 = success) $srCode = $response->getSrcode(); // Secondary return code $resultText = $response->getResultText(); // Error description text $digest = $response->getDigest(); // Response signature $digest1 = $response->getDigest1(); // Response signature with merchant number $userParam = $response->getUserParam1(); // Card hash (if enabled) $md = $response->getMd(); // Custom merchant data $gatewayKey = $response->getGatewayKey(); // Which gateway processed payment $hasError = $response->hasError(); // Quick error check ``` -------------------------------- ### Define Amount Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/request.md Specifies the payment amount. Note that the standard Amount class is deprecated in favor of AmountInPennies. ```php AmountInPennies // The conversion will make Amount self $amount = new Amount(1000.00); // or create the conversion by yourself $amount = new AmountInPennies(100000, false); ``` -------------------------------- ### Define MerOrderNum Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/request.md Sets the merchant-specific order identification. ```php use Pixidos\GPWebPay\Param\MerOrderNum; $merOrderNum = new MerOrderNum(123455); ``` -------------------------------- ### Define OrderNumber Source: https://github.com/pixidos/gpwebpay-core/blob/main/docs/request.md Sets a unique order number for the request, typically generated via a timestamp or unique ID generator. ```php // you can create on time base on any other integer unique generator. $orderNumber = new OrderNumber(time()); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.