PHPackages                             voronkovich/sberbank-acquiring-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. [API Development](/categories/api)
4. /
5. voronkovich/sberbank-acquiring-client

ActiveLibrary[API Development](/categories/api)

voronkovich/sberbank-acquiring-client
=====================================

Client for working with Sberbank's acquiring REST API

v2.10.1(1y ago)195353.0k↓41.9%58[1 issues](https://github.com/voronkovich/sberbank-acquiring-client/issues)1MITPHPPHP ^7.1||^8

Since Jun 17Pushed 1y ago18 watchersCompare

[ Source](https://github.com/voronkovich/sberbank-acquiring-client)[ Packagist](https://packagist.org/packages/voronkovich/sberbank-acquiring-client)[ Docs](https://github.com/voronkovich/sberbank-acquiring-client)[ Fund](https://ko-fi.com/voronkovich)[ RSS](/packages/voronkovich-sberbank-acquiring-client/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)DependenciesVersions (30)Used By (1)

sberbank-acquiring-client
=========================

[](#sberbank-acquiring-client)

[![Build Status](https://camo.githubusercontent.com/afb905369f0f75fcfd360629395f769880b7610524f464d3f3f1a7e099926bc9/68747470733a2f2f6170702e7472617669732d63692e636f6d2f766f726f6e6b6f766963682f7362657262616e6b2d616371756972696e672d636c69656e742e7376673f6272616e63683d6d6173746572)](https://app.travis-ci.com/github/voronkovich/sberbank-acquiring-client)[![Latest Stable Version](https://camo.githubusercontent.com/718f5b657062dd54d4371cdf480003b0ea04e2184190e4da845aa0028b466da3/68747470733a2f2f706f7365722e707567782e6f72672f766f726f6e6b6f766963682f7362657262616e6b2d616371756972696e672d636c69656e742f762f737461626c65)](https://packagist.org/packages/voronkovich/sberbank-acquiring-client)[![Total Downloads](https://camo.githubusercontent.com/ce5bba098cf46171c9bfb0adb25d40108e2dd62ca39a6985f867bd5f2249947a/68747470733a2f2f706f7365722e707567782e6f72672f766f726f6e6b6f766963682f7362657262616e6b2d616371756972696e672d636c69656e742f646f776e6c6f616473)](https://packagist.org/packages/voronkovich/sberbank-acquiring-client/stats)[![License](https://camo.githubusercontent.com/66c25023ecfedb5d41543c270df6a2f1727f8069e3a21c27e122559d3f08ac80/68747470733a2f2f706f7365722e707567782e6f72672f766f726f6e6b6f766963682f7362657262616e6b2d616371756972696e672d636c69656e742f6c6963656e7365)](./LICENSE)

PHP client for [Sberbank](https://ecomtest.sberbank.ru/doc), [Alfabank](https://pay.alfabank.ru/ecommerce/instructions/merchantManual/pages/index/rest.html) and [YooKassa](https://yoomoney.ru/i/forms/yc-program-interface-api-sberbank.pdf) REST APIs.

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

[](#requirements)

- PHP 7.1 or above (Old version for PHP 5 you can find [here](https://github.com/voronkovich/sberbank-acquiring-client/tree/1.x))
- TLS 1.2 or above (more information you can find [here](https://civicrm.org/blog/yashodha/are-you-ready-for-tls-12-update-cant-escape-it))
- `php-json` extension installed

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

[](#installation)

```
composer require 'voronkovich/sberbank-acquiring-client'
```

Usage
-----

[](#usage)

### Instantiating a client

[](#instantiating-a-client)

In most cases to instantiate a client you need to pass your `username` and `password` to a factory:

```
use Voronkovich\SberbankAcquiring\ClientFactory;

// Sberbank production environment
$client = ClientFactory::sberbank(['userName' => 'username', 'password' => 'password']);

// Sberbank testing environment
$client = ClientFactory::sberbankTest(['userName' => 'username', 'password' => 'password']);

// Alfabank production environment
$client = ClientFactory::alfabank(['userName' => 'username', 'password' => 'password']);

// Alfabank testing environment
$client = ClientFactory::alfabankTest(['userName' => 'username', 'password' => 'password']);

// YooKassa production environment
$client = ClientFactory::yookassa(['userName' => 'username', 'password' => 'password']);
```

Alternatively you can use an authentication `token`:

```
$client = ClientFactory::sberbank(['token' => 'sberbank-token']);
```

More advanced example:

```
use Voronkovich\SberbankAcquiring\ClientFactory;
use Voronkovich\SberbankAcquiring\Currency;
use Voronkovich\SberbankAcquiring\HttpClient\HttpClientInterface;

$client = ClientFactory::sberbank([
    'userName' => 'username',
    'password' => 'password',
    // A language code in ISO 639-1 format.
    // Use this option to set a language of error messages.
    'language' => 'ru',

    // A currency code in ISO 4217 format.
    // Use this option to set a currency used by default.
    'currency' => Currency::RUB,

    // An HTTP method to use in requests.
    // Must be "GET" or "POST" ("POST" is used by default).
    'httpMethod' => HttpClientInterface::METHOD_GET,

    // An HTTP client for sending requests.
    // Use this option when you don't want to use
    // a default HTTP client implementation distributed
    // with this package (for example, when you have'nt
    // a CURL extension installed in your server).
    'httpClient' => new YourCustomHttpClient(),
]);
```

Also you can use an adapter for the [Guzzle](https://github.com/guzzle/guzzle):

```
use Voronkovich\SberbankAcquiring\ClientFactory;
use Voronkovich\SberbankAcquiring\HttpClient\GuzzleAdapter;

use GuzzleHttp\Client as Guzzle;

$client = ClientFactory::sberbank([
    'userName' => 'username',
    'password' => 'password',
    'httpClient' => new GuzzleAdapter(new Guzzle()),
]);
```

Also, there are available adapters for [Symfony](https://symfony.com/doc/current/http_client.html) and [PSR-18](https://www.php-fig.org/psr/psr-18/) HTTP clents.

### Low level method "execute"

[](#low-level-method-execute)

You can interact with the Gateway REST API using a low level method `execute`:

```
$client->execute('/ecomm/gw/partner/api/v1/register.do', [
    'orderNumber' => 1111,
    'amount' => 10,
    'returnUrl' => 'http://localhost/sberbank/success',
]);

$status = $client->execute('/ecomm/gw/partner/api/v1/getOrderStatusExtended.do', [
    'orderId' => '64fc8831-a2b0-721b-64fc-883100001553',
]);
```

But it's more convenient to use one of the shortcuts listed below.

### Creating a new order

[](#creating-a-new-order)

[Sberbank](https://ecomtest.sberbank.ru/doc#tag/basicServices/operation/register)[Alfabank](https://pay.alfabank.ru/ecommerce/instructions/merchantManual/pages/index/rest.html#zapros_registratsii_zakaza_rest_)

```
use Voronkovich\SberbankAcquiring\Currency;

// Required arguments
$orderId     = 1234;
$orderAmount = 1000;
$returnUrl   = 'http://mycoolshop.local/payment-success';

// You can pass additional parameters like a currency code and etc.
$params['currency'] = Currency::EUR;
$params['failUrl']  = 'http://mycoolshop.local/payment-failure';

$result = $client->registerOrder($orderId, $orderAmount, $returnUrl, $params);

$paymentOrderId = $result['orderId'];
$paymentFormUrl = $result['formUrl'];

header('Location: ' . $paymentFormUrl);
```

If you want to use UUID identifiers ([ramsey/uuid](https://github.com/ramsey/uuid)) for orders you should convert them to a hex format:

```
use Ramsey\Uuid\Uuid;

$orderId = Uuid::uuid4();

$result = $client->registerOrder($orderId->getHex(), $orderAmount, $returnUrl);
```

Use a `registerOrderPreAuth` method to create a 2-step order.

### Getting a status of an exising order

[](#getting-a-status-of-an-exising-order)

[Sberbank](https://ecomtest.sberbank.ru/doc#tag/basicServices/operation/getOrderStatusExtended)[Alfabank](https://pay.alfabank.ru/ecommerce/instructions/merchantManual/pages/index/rest.html#rasshirenniy_zapros_sostojanija_zakaza_rest_)

```
use Voronkovich\SberbankAcquiring\OrderStatus;

$result = $client->getOrderStatus($orderId);

if (OrderStatus::isDeposited($result['orderStatus'])) {
    echo "Order #$orderId is deposited!";
}

if (OrderStatus::isDeclined($result['orderStatus'])) {
    echo "Order #$orderId was declined!";
}
```

Also, you can get an order's status by using you own identifier (e.g. assigned by your database):

```
$result = $client->getOrderStatusByOwnId($orderId);
```

### Reversing an exising order

[](#reversing-an-exising-order)

[Sberbank](https://ecomtest.sberbank.ru/doc#tag/basicServices/operation/reverse)[Alfabank](https://pay.alfabank.ru/ecommerce/instructions/merchantManual/pages/index/rest.html#zapros_otmeni_oplati_zakaza_rest_)

```
$result = $client->reverseOrder($orderId);
```

### Refunding an exising order

[](#refunding-an-exising-order)

[Sberbank](https://ecomtest.sberbank.ru/doc#tag/basicServices/operation/refund)[Alfabank](https://pay.alfabank.ru/ecommerce/instructions/merchantManual/pages/index/rest.html#zapros_vozvrata_sredstv_oplati_zakaza_rest_)

```
$result = $client->refundOrder($orderId, $amountToRefund);
```

### SBP payments using QR codes

[](#sbp-payments-using-qr-codes)

*Currently only supported by Alfabank, see [docs](https://pay.alfabank.ru/ecommerce/instructions/SBP_C2B.pdf).*

```
$result = $client->getSbpDynamicQr($orderId, [
    'qrHeight' => 100,
    'qrWidth' => 100,
    'qrFormat' => 'image',
]);

echo sprintf(
    '',
    $result['payload'],
    'data:image/png;base64,' . $result['renderedQr']
);
```

---

See `Client` source code to find methods for payment bindings and dealing with 2-step payments.

License
-------

[](#license)

Copyright (c) Voronkovich Oleg. Distributed under the MIT.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity54

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 97.3% 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 ~132 days

Recently: every ~319 days

Total

25

Last Release

533d ago

Major Versions

v1.1.3 → v2.02018-08-15

1.x-dev → v2.12018-08-19

PHP version history (3 changes)v1.0PHP &gt;=5.3

v2.0PHP ^7.1

v2.5PHP ^7.1||^8

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2299535?v=4)[Oleg Voronkovich](/maintainers/voronkovich)[@voronkovich](https://github.com/voronkovich)

---

Top Contributors

[![voronkovich](https://avatars.githubusercontent.com/u/2299535?v=4)](https://github.com/voronkovich "voronkovich (145 commits)")[![daniser](https://avatars.githubusercontent.com/u/5169543?v=4)](https://github.com/daniser "daniser (1 commits)")[![floor12](https://avatars.githubusercontent.com/u/8406969?v=4)](https://github.com/floor12 "floor12 (1 commits)")[![lexxkn](https://avatars.githubusercontent.com/u/61002247?v=4)](https://github.com/lexxkn "lexxkn (1 commits)")[![valerialukinykh](https://avatars.githubusercontent.com/u/123940772?v=4)](https://github.com/valerialukinykh "valerialukinykh (1 commits)")

---

Tags

acquiringalphabankphpsberbankclientcredit-cardacquiringsberbank

### Embed Badge

![Health badge](/badges/voronkovich-sberbank-acquiring-client/health.svg)

```
[![Health](https://phpackages.com/badges/voronkovich-sberbank-acquiring-client/health.svg)](https://phpackages.com/packages/voronkovich-sberbank-acquiring-client)
```

###  Alternatives

[openai-php/client

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

5.8k29.9M347](/packages/openai-php-client)[openai-php/laravel

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

3.7k10.2M97](/packages/openai-php-laravel)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.8M179](/packages/algolia-algoliasearch-client-php)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

75517.5M240](/packages/meilisearch-meilisearch-php)[resend/resend-php

Resend PHP library.

608.3M53](/packages/resend-resend-php)[swader/diffbot-php-client

A PHP wrapper for using Diffbot's API

5328.5k](/packages/swader-diffbot-php-client)

PHPackages © 2026

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