PHPackages                             maksimego/php-tinkoff-api - 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. [API Development](/categories/api)
4. /
5. maksimego/php-tinkoff-api

ActiveLibrary[API Development](/categories/api)

maksimego/php-tinkoff-api
=========================

PHP library for interacting with Tinkoff API

04PHP

Since Dec 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/maksimEgo/tinkoff-api)[ Packagist](https://packagist.org/packages/maksimego/php-tinkoff-api)[ RSS](/packages/maksimego-php-tinkoff-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

> # Tinkoff API Integration
>
> [](#tinkoff-api-integration)
>
> This project is a PHP implementation for integrating with Tinkoff's payment gateway using a Domain-Driven Design (DDD) and SOLID principles. The package allows easy integration of Tinkoff's payment services into any PHP application.
>
> ## Features
>
> [](#features)
>
> - Create a payment (`InitPayment`) through the Tinkoff API.
> - Type-safe models using value objects for `Amount`, `OrderId`, etc.
> - Mappers for converting API responses to corresponding entities.
> - Abstract payment class to handle common payment attributes.
>
> ## Project Structure
>
> [](#project-structure)
>
> - **src/Domain**: Contains the core domain entities and value objects.
>
>
>     - **Entity**: Contains abstract and concrete payment entities, such as `Payment` and `InitPayment`.
>     - **Enum**: Enumeration classes like `LanguageEnum` and `PayTypeEnum`.
>     - **ValueObject**: Value objects like `OrderId` and `Amount`.
> - **src/Infrastructure**: Contains infrastructure code for API communication.
>
>
>     - **Mapper**: Handles mapping between arrays and domain entities.
>     - **TinkoffClient**: Implements the communication with the Tinkoff API.
>
> ## Installation
>
> [](#installation)
>
> To install the package, navigate to your project directory and run:
>
> ```
> composer require egorov/tinkoff-api
> ```
>
>
>
> ## Usage
>
> [](#usage)
>
> ### Creating a Payment
>
> [](#creating-a-payment)
>
> To create a new payment, you need to create an instance of the `Order` entity and use `TinkoffClient` to initiate the payment:
>
> ```
> require __DIR__ . '/../vendor/autoload.php';
>
> use Egorov\TinkoffApi\Domain\Entity\Order;
> use Egorov\TinkoffApi\Domain\ValueObject\Amount;
> use Egorov\TinkoffApi\Domain\ValueObject\OrderId;
> use Egorov\TinkoffApi\Infrastructure\TinkoffClient;
>
> $orderId = new OrderId('12345');
> $amount = new Amount(10000);
>
> $order = Order::build($orderId, $amount)
>     ->withDescription('Payment for Order #12345');
>
> $terminalKey = 'YourTerminalKey';
> $password = 'YourPassword';
>
> $tinkoffClient = new TinkoffClient($terminalKey, $password);
> $payment = $tinkoffClient->initiatePayment($order);
>
> if ($payment->isSuccess()) {
>     echo "Payment successfully initiated. Payment URL: " . $payment->getPaymentUrl();
> } else {
>     echo "Failed to initiate payment. Error Code: " . $payment->getErrorCode();
> }
> ```
>
>
>
> ### Mapping Response to Payment Entity
>
> [](#mapping-response-to-payment-entity)
>
> The API responses are mapped to specific payment entities like `InitPayment`. This allows for type-safe interaction with the data:
>
> ```
> use Egorov\TinkoffApi\Infrastructure\Mapper\InitPaymentMapper;
>
> $responseData = [
>     'OrderId' => 'Order123',
>     'Amount' => 10000,
>     'Status' => 'NEW',
>     'TerminalKey' => 'TinkoffBankTest',
>     'PaymentURL' => 'https://securepayments.tinkoff.ru/dWCdXdBf',
> ];
>
> $initPayment = InitPaymentMapper::fromArray($responseData);
>
> echo "Payment Status: " . $initPayment->getStatus() . "\n";
> echo "Payment URL: " . $initPayment->getPaymentUrl() . "\n";
> ```
>
>
>
> ## Project Principles
>
> [](#project-principles)
>
> - **Domain-Driven Design (DDD)**: The project follows DDD principles by clearly separating domain logic from infrastructure and application logic.
> - **SOLID Principles**: Each class follows single responsibility and open/closed principles, making the codebase easier to extend and maintain.
>
> ## Contributing
>
> [](#contributing)
>
> Feel free to submit issues or pull requests if you encounter bugs or have suggestions for improvements.
>
> ## License
>
> [](#license)
>
> This project is licensed under the MIT License.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6b95e73c94200266a7edea3c10452179492b294454790ec8931e5e6e88f3ca1?d=identicon)[maksimego](/maintainers/maksimego)

---

Top Contributors

[![maksimEgo](https://avatars.githubusercontent.com/u/131584072?v=4)](https://github.com/maksimEgo "maksimEgo (8 commits)")

### Embed Badge

![Health badge](/badges/maksimego-php-tinkoff-api/health.svg)

```
[![Health](https://phpackages.com/badges/maksimego-php-tinkoff-api/health.svg)](https://phpackages.com/packages/maksimego-php-tinkoff-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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