Download the PHP package znojil/comgate without Composer
On this page you can find all versions of the php package znojil/comgate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package comgate
Znojil Comgate
A simple and modern PHP library for communicating with the Comgate payment gateway API.
🚀 Installation
📖 Usage
1. Client Initialization
2. Creating a Payment
If you prefer to redirect the customer directly to the payment gateway:
3. Checking Payment Status
4. Using a Custom HTTP Client
You can inject your own HTTP client implementation by passing it as the second argument to the Client constructor. Your client must implement the Znojil\Comgate\Http\Client interface.
Your implementation must honor the Znojil\Comgate\Http\Option::* keys passed in $options (e.g. Option::FollowRedirects — some requests rely on redirects not being followed automatically) and must reject unknown string keys with an exception. Integer keys are raw CURLOPT_* constants — non-cURL implementations must reject them with an exception rather than silently ignore them, so that a consumer never ends up with options that silently don't apply.
5. Handling Push Notifications
Comgate sends a push notification (HTTP POST) to your server when a payment status changes. Use Client::accept() to authenticate and process it:
accept() automatically validates the merchant and secret from the request body against your Config. If they do not match, an InvalidArgumentException is thrown.
You can also inject a PSR-7 ServerRequestInterface manually — useful in frameworks that provide it:
⚠️ Error Handling
The client throws exceptions to help you identify the issue:
Znojil\Comgate\Exception\ApiException: For API-level errors returned by Comgate (e.g. invalid parameters). Containscodeandmessagefrom the API response.Znojil\Comgate\Exception\JsonResponseException: When an API response body is not valid JSON (subtype ofResponseException).Znojil\Comgate\Exception\ClientException: For HTTP client-side errors (4xx).Znojil\Comgate\Exception\ServerException: For HTTP server-side errors (5xx).Znojil\Comgate\Exception\ResponseException: For other unsuccessful HTTP responses.Znojil\Comgate\Exception\InvalidArgumentException: For invalid input (e.g. invalid credentials, missing required data).
All exceptions thrown by the library implement the
Znojil\Comgate\Exception\Exceptionmarker interface, so a single catch can cover them all.
📄 License
This library is open-source software licensed under the MIT license.