PHPackages                             kassacom/php-sdk - 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. [Payment Processing](/categories/payments)
4. /
5. kassacom/php-sdk

ActiveLibrary[Payment Processing](/categories/payments)

kassacom/php-sdk
================

Kassa.com PHP SDK

v1.9.10(2mo ago)038.4k↓37.8%62MITPHPPHP &gt;=5.5CI failing

Since Sep 14Pushed 2mo ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (56)Used By (2)

Kassa.com PHP SDK
=================

[](#kassacom-php-sdk)

[![Latest Stable Version](https://camo.githubusercontent.com/77476781a2fd6248b61a7d49517278b920aae6dc3b33e7492f4f17802c164092/687474703a2f2f706f7365722e707567782e6f72672f6b61737361636f6d2f7068702d73646b2f76)](https://packagist.org/packages/kassacom/php-sdk)[![Total Downloads](https://camo.githubusercontent.com/e9187fc4bfa68e295f9c9af0048fcf01094f378f4fc2a92fc3fbd6e26d9698ae/687474703a2f2f706f7365722e707567782e6f72672f6b61737361636f6d2f7068702d73646b2f646f776e6c6f616473)](https://packagist.org/packages/kassacom/php-sdk)[![Latest Unstable Version](https://camo.githubusercontent.com/6de8cbf23fa8c9abcfc86fd6f3ca09f80190d1d032f75ea99a823c4a36bb08e1/687474703a2f2f706f7365722e707567782e6f72672f6b61737361636f6d2f7068702d73646b2f762f756e737461626c65)](https://packagist.org/packages/kassacom/php-sdk)

Documentation:

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

[](#requirements)

PHP 5.5 and later.

Dependencies
------------

[](#dependencies)

The bindings require the following extensions in order to work properly:

- [`curl`](https://secure.php.net/manual/en/book.curl.php), although you can use your own non-cURL client if you prefer.
- [`json`](https://secure.php.net/manual/en/book.json.php)
- [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php) (Multibyte String)
- [`php-fig/log`](https://github.com/php-fig/log)
- [`guzzlehttp/psr7`](https://github.com/guzzle/psr7)

Optionally

- [`guzzlehttp/guzzle`](https://github.com/guzzle/guzzle) for use guzzle instead of cURL.

Composer
--------

[](#composer)

You can install the lib via [Composer](http://getcomposer.org/). Run the following command:

```
composer require kassacom/php-sdk
```

To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```
require_once('vendor/autoload.php');
```

If you use Composer, these dependencies should be handled automatically.

Getting Started
---------------

[](#getting-started)

We recommend using the GuzzleHttp Client

### Init client

[](#init-client)

```
$guzzleClient = new GuzzleHttp\Client();
$transport = new KassaCom\SDK\Transport\GuzzleApiTransport($guzzleClient);
$client = new KassaCom\SDK\Client($transport);
$client->setAuth('login', 'secret'); // or for basic authorization $client->setAuth('login', 'password', KassaCom\SDK\Transport\Authorization\BasicAuthorization::class);
```

All requests are processed in similar steps:

1. Create request instance of `KassaCom\SDK\Model\Request\AbstractRequest`
2. Request serialization
3. Sending a request to the server
4. You have a response object instance of `KassaCom\SDK\Model\Response\AbstractResponse` or throws exception if request fail

All requests are creating by suitable objects or can be created on the basis of arrays, integers and strings

#### Create payment

[](#create-payment)

Creating request with object

```
// Create a request object
$createPaymentRequest = new KassaCom\SDK\Model\Request\Payment\CreatePaymentRequest();

// Set up $createPaymentRequest with required params

try {
    /** @var KassaCom\SDK\Model\Response\Payment\CreatePaymentResponse $createPaymentResponse */
    $createPaymentResponse = $client->createPayment($createPaymentRequest);
} catch (\Exception $e) {
    // ...
}
```

or you can create request with array

```
$requestArray = [
    'order' => [/*...*/],
    'settings' => [/*...*/],
    'custom_parameters' => [/*...*/],
    'receipt' => [/*...*/],
];

try {
    /** @var KassaCom\SDK\Model\Response\Payment\CreatePaymentResponse $createPaymentResponse */
    $createPaymentResponse = $client->createPayment($requestArray);
} catch (\Exception $e) {
    // ...
}
```

#### Process payment

[](#process-payment)

Creating request with object

```
// Create a request object
$processPayment = new KassaCom\SDK\Model\Request\Payment\ProcessPaymentRequest();

// Set up $processPayment with required params

try {
    /** @var KassaCom\SDK\Model\Response\Payment\ProcessPaymentResponse $processPaymentResponse */
    $processPaymentResponse = $client->processPayment($processPayment);
} catch (\Exception $e) {
    // ...
}
```

or you can create request with array

```
$requestArray = [
    'token' => 'token',
    'ip' => '127.0.0.1',
    'payment_method_data' => [/*...*/],
];

try {
    /** @var KassaCom\SDK\Model\Response\Payment\ProcessPaymentResponse $processPaymentResponse */
    $processPaymentResponse = $client->processPayment($requestArray);
} catch (\Exception $e) {
    // ...
}
```

#### Capture payment

[](#capture-payment)

Creating request with object

```
// Create a request object
$capturePaymentRequest = new KassaCom\SDK\Model\Request\Payment\CapturePaymentRequest('token-string-from-create-payment-step');

try {
    /** @var KassaCom\SDK\Model\Response\Payment\CapturePaymentResponse $capturePaymentResponse */
    $capturePaymentResponse = $client->capturePayment($capturePaymentRequest);
} catch (\Exception $e) {
    // ...
}
```

or you can create request with token

```
try {
    /** @var KassaCom\SDK\Model\Response\Payment\CapturePaymentResponse $capturePaymentResponse */
    $processPaymentResponse = $client->processPayment('token-string-from-create-payment-step');
} catch (\Exception $e) {
    // ...
}
```

#### Get payment info

[](#get-payment-info)

Creating request with object

```
// Create a request object
$getPaymentRequest = new KassaCom\SDK\Model\Request\Payment\GetPaymentRequest('token-string-from-create-payment-step');

try {
    /** @var KassaCom\SDK\Model\Response\Payment\GetPaymentResponse $getPaymentResponse */
    $getPaymentResponse = $client->getPayment($getPaymentRequest);
} catch (\Exception $e) {
    // ...
}
```

or you can create request with token

```
try {
    /** @var KassaCom\SDK\Model\Response\Payment\GetPaymentResponse $getPaymentResponse */
    $getPaymentResponse = $client->getPayment('token-string-from-create-payment-step');
} catch (\Exception $e) {
    // ...
}
```

#### Cancel payment

[](#cancel-payment)

Creating request with object

```
// Create a request object
$cancelPaymentRequest = new KassaCom\SDK\Model\Request\Payment\CancelPaymentRequest('token-string-from-create-payment-step');

try {
    /** @var KassaCom\SDK\Model\Response\Payment\CancelPaymentResponse $cancelPaymentResponse */
    $cancelPaymentResponse = $client->cancelPayment($cancelPaymentRequest);
} catch (\Exception $e) {
    // ...
}
```

or you can create request with token

```
try {
    /** @var KassaCom\SDK\Model\Response\Payment\CancelPaymentResponse $cancelPaymentResponse */
    $cancelPaymentResponse = $client->cancelPayment('token-string-from-create-payment-step');
} catch (\Exception $e) {
    // ...
}
```

#### Create payout

[](#create-payout)

Creating request with object

```
// Create a request object
$createPayoutRequest = new KassaCom\SDK\Model\Request\Payout\CreatePayoutRequest();

// Set up $createPayoutRequest with required params

try {
    /** @var KassaCom\SDK\Model\Response\Payout\CreatePayoutResponse $createPayoutResponse */
    $createPayoutResponse = $client->createPayout($createPayoutRequest);
} catch (\Exception $e) {
    // ...
}
```

or you can create request with array

```
$requestArray = [
    'transaction_id' => 'transaction_id',
    'wallet_id' => 123,
    'fee_type' => 'fee_type',
    'payout_method_data' => [/*...*/],
    'order' => [/*...*/],
];

try {
    /** @var KassaCom\SDK\Model\Response\Payout\CreatePayoutResponse $createPayoutResponse */
    $createPayoutResponse = $client->createPayout($requestArray);
} catch (\Exception $e) {
    // ...
}
```

#### Get payout info

[](#get-payout-info)

Creating request with object

```
// Create a request object
$getPayoutRequest = new KassaCom\SDK\Model\Request\Payout\GetPayoutRequest();

// Set up $getPayoutRequest with required params

try {
    /** @var KassaCom\SDK\Model\Response\Payout\GetPayoutResponse $getPayoutResponse */
    $getPayoutResponse = $client->getPayout($getPayoutRequest);
} catch (\Exception $e) {
    // ...
}
```

or you can create request with array

```
$requestArray = [
    'transaction_id' => 'transaction_id',
    'wallet_id' => 123,
];

try {
    /** @var KassaCom\SDK\Model\Response\Payout\GetPayoutResponse $getPayoutResponse */
    $getPayoutResponse = $client->getPayout($requestArray);
} catch (\Exception $e) {
    // ...
}
```

or create by id

```
try {
    /** @var KassaCom\SDK\Model\Response\Payout\GetPayoutResponse $getPayoutResponse */
    $getPayoutResponse = $client->getPayout(123);
} catch (\Exception $e) {
    // ...
}
```

#### Payments report

[](#payments-report)

Download report file

```
$paymentsReport = new KassaCom\SDK\Model\Request\Reports\PaymentsReportRequest();
$paymentsReport->setDatetimeFrom(new \DateTime('2 weeks ago'))
            ->setDatetimeTo(new \DateTime());

$response = $client->getPaymentsReport($paymentsReport);

http_response_code($response->getStatusCode());
$stream = $response->getBody();

foreach ($response->getHeaders() as $key => $header) {
    header($key . ': ' . join(',', $header));
}

echo $stream->getContents();
```

#### Payouts report

[](#payouts-report)

Download report file

```
$payoutsReportRequest = new KassaCom\SDK\Model\Request\Reports\PayoutsReportRequest();
$payoutsReportRequest->setDatetimeFrom(new \DateTime('2 weeks ago'))
            ->setDatetimeTo(new \DateTime());

$response = $client->getPayoutsReport($payoutsReportRequest);

http_response_code($response->getStatusCode());
$stream = $response->getBody();

foreach ($response->getHeaders() as $key => $header) {
    header($key . ': ' . join(',', $header));
}

echo $stream->getContents();
```

#### Exceptions

[](#exceptions)

- `KassaCom\SDK\Exception\TransportException` - throws in the case of an api transport error. For example, when authorization data is not provided.
- `KassaCom\SDK\Exception\JsonParseException` - the server response doesn't contain a valid json.
- `KassaCom\SDK\Exception\ServerResponse\ResponseException` - 4xx and 5xx server errors.
- `KassaCom\SDK\Exception\Response\ResponseParseException` - create response errors.
- `KassaCom\SDK\Exception\Request\RequestParseException` - create request errors.

### Processing notification from server

[](#processing-notification-from-server)

This code is responsible for processing the payment result. You need to create handler, make it available on URL in your application and specify the URL in the project settings in [kassa.com](http://kassa.com). This handler will be called after the user makes a payment using the form on kassa.com

```
$notification = new Notification();
$notification->setApiKey('api-key');
$notification->process();
```

You can use manual response to server:

```
$notification->process(false);

// if success
$notification->successResponse();
// if error
$notification->errorResponse('Error message');
```

If you use a proxy server, you can skip the IP check

```
$notification->setSkipIpCheck();
```

Custom Api Transport
--------------------

[](#custom-api-transport)

You can create your own api transport by extending `KassaCom\SDK\Transport\AbstractApiTransport`

```
class MyApiTransport extends AbstractApiTransport {
    protected function sendRequest(Psr7\Request $request) {
        // Implementing the sendRequest() method
    }
}
```

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance82

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 88.8% 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 ~50 days

Recently: every ~84 days

Total

55

Last Release

89d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/99090bacdb7e557f2210ee3078c29060aa329231bdd31731604e2f390c2f5a92?d=identicon)[kassacom](/maintainers/kassacom)

---

Top Contributors

[![devkassacom](https://avatars.githubusercontent.com/u/38000976?v=4)](https://github.com/devkassacom "devkassacom (95 commits)")[![Dezinger](https://avatars.githubusercontent.com/u/432272?v=4)](https://github.com/Dezinger "Dezinger (4 commits)")[![zavodnoyapl1992](https://avatars.githubusercontent.com/u/3448342?v=4)](https://github.com/zavodnoyapl1992 "zavodnoyapl1992 (4 commits)")[![kalyabin](https://avatars.githubusercontent.com/u/5373014?v=4)](https://github.com/kalyabin "kalyabin (2 commits)")[![agentsib](https://avatars.githubusercontent.com/u/1577055?v=4)](https://github.com/agentsib "agentsib (1 commits)")[![burnb](https://avatars.githubusercontent.com/u/5370603?v=4)](https://github.com/burnb "burnb (1 commits)")

---

Tags

moneysdkpaymentpaymentspaycardskassa.com

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kassacom-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/kassacom-php-sdk/health.svg)](https://phpackages.com/packages/kassacom-php-sdk)
```

###  Alternatives

[amzn/amazon-pay-sdk-php

Amazon Pay SDK (PHP)

20512.1M3](/packages/amzn-amazon-pay-sdk-php)[amzn/amazon-pay-api-sdk-php

Amazon Pay API SDK (PHP)

505.1M9](/packages/amzn-amazon-pay-api-sdk-php)[yandex-money/yandex-money-sdk-php

Yandex.Money API SDK for PHP

105167.4k2](/packages/yandex-money-yandex-money-sdk-php)[ondrakoupil/csob-eapi-paygate

PHP Client library for easy integration of ČSOB payment gateway

44416.9k3](/packages/ondrakoupil-csob-eapi-paygate)

PHPackages © 2026

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