PHPackages                             comfino/api-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. comfino/api-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

comfino/api-client
==================

Standard PHP API client library for the Comfino payment gateway with PSR-18/PSR-7 support.

1.2.0(1mo ago)0401BSD-3-ClausePHPPHP &gt;=8.2CI passing

Since Oct 24Pushed 3w ago1 watchersCompare

[ Source](https://github.com/comfino/api-client)[ Packagist](https://packagist.org/packages/comfino/api-client)[ Docs](https://github.com/comfino/api-client)[ RSS](/packages/comfino-api-client/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (13)Versions (5)Used By (0)

Comfino API Client
==================

[](#comfino-api-client)

[![Latest Version](https://camo.githubusercontent.com/ab402dadceff0f110a1494faa0b734104241d7752e921ae4f6ae150ba64b9270/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f636f6d66696e6f2f6170692d636c69656e742e737667)](https://github.com/comfino/api-client/releases)[![PHP Version](https://camo.githubusercontent.com/22fea538eaa3d43ec49d07a9deb3fb84dd80cda05ee592de954ed990e25de2b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f636f6d66696e6f2f6170692d636c69656e742e737667)](https://packagist.org/packages/comfino/api-client)[![Build Status](https://github.com/comfino/api-client/actions/workflows/tests.yml/badge.svg)](https://github.com/comfino/api-client/actions/workflows/tests.yml)[![Software License](https://camo.githubusercontent.com/ba163b9d6a47bcfeeaeeae8a91d4fa1a8df3d528367d69952295f31f2f770cad/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d425344253230332d2d436c617573652d6f72616e67652e737667)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/312e144dc689942d0970e1eb861c16e3cebd0548861d4e05f3c8546651815fc4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6d66696e6f2f6170692d636c69656e742e737667)](https://packagist.org/packages/comfino/api-client)

Warning

**This package is deprecated and no longer maintained.**

`comfino/api-client` has reached End of Life with the v1.2.0 release. This repository is archived and read-only — no further bug fixes, security patches, or features will be published.

**Please migrate to the actively developed successor:**

```
composer require comfino/php-api-client
```

- Packagist: [comfino/php-api-client](https://packagist.org/packages/comfino/php-api-client)
- GitHub: [comfino/php-api-client](https://github.com/comfino/php-api-client)

The successor requires PHP 8.1+ and introduces exponential backoff retry, HMAC-signed authentication tokens, CR-Signature (SHA3-256) webhook verification, and forward-compatible enum handling.

---

**Comfino API client library**

Standard PHP API client library for the Comfino payment gateway.

Features
--------

[](#features)

- PSR-18 HTTP Client compatibility
- PSR-7 HTTP Messages support
- Production and sandbox environment support

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- PSR-18 HTTP Client implementation
- Composer

Installation
------------

[](#installation)

Install via Composer:

```
composer require comfino/api-client
```

Usage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

```
use Comfino\Api\Client;

// Initialize the client.
$client = new Client(
    $requestFactory, // PSR-17 Request Factory
    $streamFactory,  // PSR-17 Stream Factory
    $httpClient,     // PSR-18 HTTP Client
    'your-api-key'
);

// Enable sandbox mode for testing.
$client->enableSandboxMode();

// Or disable it for production.
$client->disableSandboxMode();
```

### Making API calls

[](#making-api-calls)

The Client class provides convenience methods for all API operations:

```
use Comfino\Api\Dto\Payment\LoanQueryCriteria;
use Comfino\Shop\Order\OrderInterface;

// Create a loan application.
$order = /* OrderInterface instance */;
$response = $client->createOrder($order);
$applicationUrl = $response->applicationUrl;

// Get order details.
$orderDetails = $client->getOrder($orderId);

// Get available financial products.
$queryCriteria = new LoanQueryCriteria(/* ... */);
$products = $client->getFinancialProducts($queryCriteria);

// Check if shop account is active.
$isActive = $client->isShopAccountActive();

// Cancel an order.
$client->cancelOrder($orderId);
```

Architecture
------------

[](#architecture)

### Core components

[](#core-components)

- **Client class** (`src/Api/Client.php`): Main entry point using dependency injection with PSR-18 HTTP Client interfaces.
- **Request/Response pattern**: Each API operation has dedicated classes using Command pattern.
- **Dual DTO layers**: API layer DTOs (readonly classes) and Shop domain layer (interface-based for flexibility).
- **Environment support**: Configurable API hosts for production and sandbox.

### Key design patterns

[](#key-design-patterns)

- **Abstract base classes**: `Request` and `Response` define common behavior.
- **Strategy pattern**: Pluggable serializers through `SerializerInterface` (default: JSON),
- **Interface contracts**: Shop integration through `OrderInterface`, `CartInterface`, `CustomerInterface`.
- **Trait-based sharing**: Common functionality through traits like `CartTrait`.

### Directory structure

[](#directory-structure)

```
src/
├── Api/          # Core API client, requests, responses, DTOs, exceptions.
├── Shop/         # Domain models for e-commerce integration.
└── Enum.php      # Base enum class for PHP version compatibility.
tests/            # PHPUnit tests with trait-based organization.

```

### Error handling

[](#error-handling)

Exception hierarchy based on HTTP status codes:

- **400**: `RequestValidationError` - Invalid request data.
- **401**: `AuthorizationError` - Authentication failure.
- **402-405**: `AccessDenied` - Permission issues.
- **500+**: `ServiceUnavailable` - Server errors.

All exceptions implement `HttpErrorExceptionInterface` and preserve request/response context for debugging.

Development
-----------

[](#development)

### Install dependencies

[](#install-dependencies)

```
# Using the wrapper script (Docker or local).
./bin/composer install

# Update dependencies.
./bin/composer update
```

### Running tests

[](#running-tests)

```
# Run all tests.
./bin/composer test

# Or use PHPUnit directly.
./vendor/bin/phpunit

# Run specific test.
./vendor/bin/phpunit tests/Api/ClientTest.php

# Generate coverage report (requires Xdebug).
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html coverage
```

### Docker development

[](#docker-development)

```
# Start development environment.
docker-compose up -d

# Run commands inside container.
docker-compose exec api-client-php composer test
docker-compose exec api-client-php php -v
```

Testing approach
----------------

[](#testing-approach)

- Mock HTTP clients for integration testing.
- Trait-based test organization (`ClientTestTrait`, `ReflectionTrait`).
- Comprehensive coverage of success and error scenarios.
- Validation of request construction, response parsing, and error handling.

PSR standards
-------------

[](#psr-standards)

This library follows PHP Standards Recommendations:

- **PSR-4**: Autoloading
- **PSR-7**: HTTP Messages
- **PSR-18**: HTTP Client

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

This library is licensed under the BSD 3-Clause License. See the [LICENSE](LICENSE) file for details.

Support
-------

[](#support)

For bug reports and feature requests, please use the [GitHub issue tracker](https://github.com/comfino/api-client/issues).

Contributing
------------

[](#contributing)

Contributions are welcome! Please ensure all tests pass before submitting pull requests:

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance93

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~69 days

Total

4

Last Release

43d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/83001403?v=4)[Artos Rakshasa](/maintainers/akozubskicr)[@akozubskicr](https://github.com/akozubskicr)

---

Top Contributors

[![akozubskicr](https://avatars.githubusercontent.com/u/83001403?v=4)](https://github.com/akozubskicr "akozubskicr (104 commits)")

---

Tags

psr-7apiclientpsr-18paymentgatewayinstallmentsbnplpay latercomfinodeferred payments

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/comfino-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/comfino-api-client/health.svg)](https://phpackages.com/packages/comfino-api-client)
```

###  Alternatives

[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60216.0M85](/packages/mollie-mollie-api-php)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

185702.8k44](/packages/laudis-neo4j-php-client)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28150.5k](/packages/phpro-http-tools)[chillerlan/php-httpinterface

A PSR-7/17/18 http message/client implementation

1418.3k8](/packages/chillerlan-php-httpinterface)[art4/requests-psr18-adapter

Use WordPress/Requests as a PSR-18 HTTP client

157.1k](/packages/art4-requests-psr18-adapter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
