PHPackages                             pashamesh/psb-acquiring-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. [API Development](/categories/api)
4. /
5. pashamesh/psb-acquiring-php-sdk

ActiveLibrary[API Development](/categories/api)

pashamesh/psb-acquiring-php-sdk
===============================

PromSvyazBank (https://www.psbank.ru/) acquiring API PHP Software Development Kit.

0.4.0(1y ago)16442MITPHPPHP ^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0CI passing

Since Feb 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/pashamesh/psb-acquiring-php-sdk)[ Packagist](https://packagist.org/packages/pashamesh/psb-acquiring-php-sdk)[ RSS](/packages/pashamesh-psb-acquiring-php-sdk/feed)WikiDiscussions main Synced today

READMEChangelog (6)Dependencies (5)Versions (7)Used By (0)

 [![Code style](https://github.com/pashamesh/psb-acquiring-php-sdk/actions/workflows/code_style.yml/badge.svg)](https://github.com/pashamesh/psb-acquiring-php-sdk/actions/workflows/code_style.yml/badge.svg) [![Tests](https://github.com/pashamesh/psb-acquiring-php-sdk/actions/workflows/tests.yml/badge.svg)](https://github.com/pashamesh/psb-acquiring-php-sdk/actions/workflows/tests.yml/badge.svg)

[![](.media/logo.svg)](https://www.psbank.ru/) acquiring API PHP SDK.
=====================================================================

[](#-acquiring-api-php-sdk)

This package provides Software Development Kit for PromSvyazBank (PSB) Acquiring API.

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

[](#installation)

You can install the package via composer:

```
composer require pashamesh/psb-acquiring-php-sdk
```

Usage
-----

[](#usage)

### Setup client

[](#setup-client)

Setup instance of `Config`:

```
use Pashamesh\PsbAcquiringPhpSdk\Config;
use Pashamesh\PsbAcquiringPhpSdk\PsbClient;

$config = Config::fromArray([
    'component1' => '',
    'component2' => '',
    'merchantName' => 'Real Shop',
    'merchantNumber' => '',
    'terminalNumber' => '',
    'merchantEmail' => '',
    'notifyUrl' => 'https://some.domain/notify.php',
    'returnUrl' => 'https://some.domain/',
]);
$psb = new PsbClient($config);
```

where `component1`, `component2`, `merchantNumber` and `terminalNumber` are credentials provided by bank.

#### Test environment

[](#test-environment)

To configure client to use test environment for test and development purposes just skip `component1` and `component2`:

```
use Pashamesh\PsbAcquiringPhpSdk\Config;
use Pashamesh\PsbAcquiringPhpSdk\PsbClient;

$testEnvironmentConfig = Config::fromArray([
    'merchantName' => 'Test Shop',
    'merchantNumber' => '000599979036777',
    'terminalNumber' => '79036777',
    'merchantEmail' => 'merchant@mail.test',
    'notifyUrl' => 'https://some.domain/notify.php',
    'returnUrl' => 'https://some.domain/',
]);
$psb = new PsbClient($testEnvironmentConfig);
```

How to use
----------

[](#how-to-use)

### Preauthorization

[](#preauthorization)

#### Start preauthorization

[](#start-preauthorization)

Render and automatically submit preauthorization form which will redirect customer to the bank payment page:

```
$customerEmail = 'cardholder@mail.test';
$orderId = '620749153';
$amount = 300.;

$psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->preauthorize($amount)
    ->sendForm();
```

Or it's possible to get form HTML content if you need more control:

```
$preauthorizeFormHtml = $psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->preauthorize($amount)
    ->getForm();
```

It's also possible to get payment link for preauthorization which maybe sent to customer by email for example:

```
$expiresAt = '01.04.2023 03:30:00';

$preauthorizeLink = $psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->additionalInfo('Additional information')
    ->preauthorize($amount)
    ->getLink($expiresAt);
```

To get payment status, use `getStatus` method after building client

```
$psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->preauthorize($amount)
    ->getStatus();

```

To save card during the preauthorization process use `preauthorizeAndSaveCard` method:

```
$psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->preauthorizeAndSaveCard($amount)
    ->sendForm();
```

Notification HTTP call will contain `TOKEN_ID` identifying saved card.

There is a `preauthorizeUsingCard` to do preauthorization and use already saved card:

```
$cardTokenId = '';

$psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->preauthorizeUsingCard($amount, $cardTokenId)
    ->sendForm();
```

#### Complete preauthorization

[](#complete-preauthorization)

```
$rrn = '';
$intRef = '';

$finalAmount = 300.;

$syncResponse = $psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->transaction($rrn, $intRef, $amount)
    ->completePreauthorization($finalAmount)
    ->sendRequest();
```

#### Cancel preauthorization

[](#cancel-preauthorization)

```
$syncResponse = $psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->transaction($rrn, $intRef, $amount)
    ->cancelPreauthorization($finalAmount)
    ->sendRequest();
```

Purchase
--------

[](#purchase)

Purchase uses similar to preauthorization workflow. Render and automatically submit preauthorization form which will redirect customer to the bank payment page:

```
$psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->purchase($amount)
    ->sendForm();
```

Or get form HTML content :

```
$preauthorizeFormHtml = $psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->purchase($amount)
    ->getForm();
```

Or get payment link for purchase:

```
$expiresAt = '01.04.2023 03:30:00';

$purchaseLink = $psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->purchase($amount)
    ->getLink($expiresAt);
```

To save card during the purchase process use `purchaseAndSaveCard` method:

```
$psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->purchaseAndSaveCard($amount)
    ->sendForm();
```

There is a `purchaseUsingCard` to do purchase and use already saved card:

```
$cardTokenId = '';

$psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->purchaseUsingCard($amount, $cardTokenId)
    ->sendForm();
```

Recurring payment
-----------------

[](#recurring-payment)

### Register

[](#register)

```
$frequency = 1;
$expirationDate = '20240101';

$psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->purchase($amount)
    ->registerRecurring($frequency, $expirationDate)
    ->sendForm();
```

### Do payment

[](#do-payment)

```
$recurringRrn = '';
$recurringIntRef = '';

$syncResponse = $psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->doRecurringPayment($amount, $recurringRrn, $recurringIntRef)
    ->sendRequest();
```

Refund
------

[](#refund)

```
$rrn = '';
$intRef = '';

$response = $psb
    ->customer($customerEmail)
    ->order($orderId, "Order #{$orderId}")
    ->transaction($rrn, $intRef, $amount)
    ->refund($finalAmount)
    ->sendRequest();
```

Cards
-----

[](#cards)

### Save card from existing transaction

[](#save-card-from-existing-transaction)

```
$rrn = '';
$intRef = '';

$syncResponse = $psb
    ->customer($customerEmail)
    ->order($orderId, "Test payment")
    ->transaction($rrn, $intRef)
    ->saveCard()
    ->sendRequest();
```

`$syncResponse` will contain `TOKEN_ID` identifying saved card.

### Forget saved card

[](#forget-saved-card)

```
$cardTokenId = '';

$syncResponse = $psb
    ->forgetCard($cardTokenId)
    ->sendRequest();

if ($syncResponse->isOperationApproved()) {
    // The card token was forgotten.
}
```

### Handle callback HTTP call

[](#handle-callback-http-call)

Payload of asynchronous HTTP callback request must be validated for valid signature. SDK provide convenient method `handleCallbackRequest`. It validates signature and returns [Payload](src/Payload.php) model with request attributes.

#### Example

[](#example)

```
try {
    $payload = $client->handleCallbackRequest($_POST);
    if ($payload->isOperationApproved()) {
        $orderId = $payload->order;
        $referenceReturnNumber = $payload->rrn;
        $internalReference = $payload->int_ref;

        // Process data here. For example store in database.
    }

    echo "OK";
} catch (Exception $exception) {
    echo $exception->getMessage();
}
```

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

[](#development)

There is a Docker-compose setup and set of handy `make` shortcuts for development purposes.

### Install dependencies

[](#install-dependencies)

Use next command to install composer dependencies:

```
make
```

### Code styling

[](#code-styling)

This package follows the [PSR-12](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md) coding standard and the [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md) autoload standard.

Use next command to fix code styling:

```
make lint
```

### Running tests

[](#running-tests)

Use next command to run `Unit` and code static analysis:

```
make test
```

Links
-----

[](#links)

- [Original docs (RU)](https://www.psbank.ru/qpstorage/psb/images/Interaction_procedure_standard.pdf)

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance46

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~163 days

Recently: every ~200 days

Total

6

Last Release

402d ago

PHP version history (2 changes)0.1.0PHP &gt;=7.4

0.4.0PHP ^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b0c97dfe2df10c3ddf1c53695bac7a14bd337d24f11e45df8f8927329f2ae64?d=identicon)[pashamesh](/maintainers/pashamesh)

---

Top Contributors

[![pashamesh](https://avatars.githubusercontent.com/u/1695806?v=4)](https://github.com/pashamesh "pashamesh (24 commits)")[![Back1ng](https://avatars.githubusercontent.com/u/50419205?v=4)](https://github.com/Back1ng "Back1ng (4 commits)")

---

Tags

acquiringapi-clientpackagephppromsvyazbankpsbpsbanksdkphpapisdkpackagepsbPromsvyazbankpsbankpsb sdkpsb apipsb acquiringpsb package

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pashamesh-psb-acquiring-php-sdk/health.svg)

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

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k9.5M89](/packages/openai-php-laravel)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[resend/resend-php

Resend PHP library.

617.2M43](/packages/resend-resend-php)[php-opencloud/openstack

PHP SDK for OpenStack APIs. Supports BlockStorage, Compute, Identity, Images, Networking and Metric Gnocchi

2312.4M25](/packages/php-opencloud-openstack)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M13](/packages/checkout-checkout-sdk-php)[clicksend/clicksend-php

351.6M11](/packages/clicksend-clicksend-php)

PHPackages © 2026

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