PHPackages                             payselection/payselection-php-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. payselection/payselection-php-client

ActiveLibrary[API Development](/categories/api)

payselection/payselection-php-client
====================================

Payselection api client

v2.0.12(1y ago)355.8k↓19.9%4MITPHPPHP &gt;=7.4

Since Mar 28Pushed 1y ago3 watchersCompare

[ Source](https://github.com/Payselection/Payselection-PayApp-SDK-PHP)[ Packagist](https://packagist.org/packages/payselection/payselection-php-client)[ RSS](/packages/payselection-payselection-php-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (0)

Payselection api Library
========================

[](#payselection-api-library)

Оглавление
----------

[](#оглавление)

- [Установка](#%D1%83%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BA%D0%B0)
- [Начало работы](#%D0%BD%D0%B0%D1%87%D0%B0%D0%BB%D0%BE-%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D1%8B)
- [Методы API](#%D0%BC%D0%B5%D1%82%D0%BE%D0%B4%D1%8B-api)
    - [Create Webpay](#create-webpay)
    - [Get Order Status](#get-order-status)
    - [Get Order Status (extended)](#get-order-status-extended)
    - [Get transaction Status](#get-transaction-status)
    - [Get transaction Status (extended)](#get-transaction-status-extended)
    - [Get transaction Status (by-dates)](#get-transaction-status-by-dates)
    - [Paylink Create](#create-paylink)
    - [Paylink Void](#void-paylink)
    - [Create Payment](#create-payment)
    - [Create Block](#create-block)
    - [Rebill Payment](#rebill-payment)
    - [Confirm Payment](#confirm-payment)
    - [Create Refund](#create-refund)
    - [Cancel Payment](#cancel-payment)
    - [Charge Payment](#charge-payment)
    - [Cancel Subscription](#cancel-subscription)
    - [Create Payout](#create-payout)
    - [Get Balance](#get-balance)
    - [Register Recurring](#register-recurring)
    - [Search Recurring](#search-recurring)
    - [Change Recurring](#change-recurring)
    - [Cancel Recurring](#cancel-recurring)
- [Работа с webhooks](#webhooks)
- [Webhook для проверки платежа](#verify-payment-webhooks)

Установка
-----------------------------------------------

[](#установка-)

Установить библиотеку можно с помощью composer:

```
composer require payselection/payselection-php-client

```

Начало работы
-------------------------------------------------------

[](#начало-работы-)

1. Создайте экземпляр объекта клиента.

```
$apiClient = new \PaySelection\Library();
$apiClient->setConfiguration([
    'webpay_url' => 'https://webform.payselection.com',
    'api_url' => 'https://gw.payselection.com',
    'site_id' => '123',
    'secret_key' => '###########',
    'public_key' => '###########',
    'site_url' => 'https://test.com'
    'webhook_url' => 'https://webhook.site/notification/'
]);
```

Значение `webhook_url` должно совпадать со значением `WebhookUrl` из запросов. Опциональное значение `public_key` может использоваться в методах Paylink и Webpay. При заполнении `public_key` необходимо обязательное заполнение `site_url`(его значение уточните у своего менеджера).

2. Вызовите нужный метод API.

Методы API
-------------------------------------------------

[](#методы-api-)

### Create Webpay

[](#create-webpay-)

[Create Webpay в документации](https://api.payselection.com/#operation/Create)

Создайте платёж, чтобы Покупатель смог оплатить его

```
try {
    $response = $apiClient->createWebPay([
        'MetaData' => [
            'PaymentType' => 'Pay'
        ],
        'PaymentRequest' => [
            'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac1200021',
            'Amount' => '100.00',
            'Currency' => 'RUB',
            'Description' => 'Order description',
            'RebillFlag' => true,
            'ExtraData' => [
                'WebhookUrl' => 'https://webhook.site/f2bea4b3-e85c-40e9-9587-b588cfda84d3'
            ],
        ],
        'ReceiptData' => [
            'timestamp' => '2023-01-11T13:38+0000',
            'external_id' => '12345678',
            'receipt' => [
                'client' => [
                    'name' => 'Inan Ivanov',
                    'email' => 'ivan@example.com',
                ],
                'company' => [
                    'email' => 'company@example.com',
                    'inn' => '12345',
                    'payment_address' => 'company address',
                ],
                'items' => [
                    [
                        'name' => 'Product title 1',
                        'price' => 123.00,
                        'quantity' => 1,
                        'sum' => 123.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                    ],
                    [
                        'name' => 'Product title 2',
                        'price' => 10.00,
                        'quantity' => 2,
                        'sum' => 20.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                        ],
                ],
                'payments' => [
                    [
                        'type' => 1,
                        'sum' => 143.00
                    ]
                ],
                'total' => 143.00
            ]
        ],
        'CustomerInfo' => [
            'ZIP' => '222410',
            'Language' => 'ru'
        ],
        'RecurringData' => [
            'Amount' => '100.00',
            'Currency' => 'RUB',
            'Description' => 'Recurring description',
            'WebhookUrl' => 'https://webhook.site/f2bea4b3-e85c-40e9-9587-b588cfda84d3',
            'AccountId' => 'order63',
            'Email' => 'user@example.com',
            'StartDate' => '2023-05-11T13:38+0000',
            'Interval' => '5',
            'Period' => 'day',
            'MaxPeriods' => '3',
            'ReceiptData' => [
                'timestamp' => '2023-01-11T13:38+0000',
                'external_id' => '12345678',
                'receipt' => [
                    'client' => [
                        'name' => 'Inan Ivanov',
                        'email' => 'ivan@example.com',
                    ],
                    'company' => [
                        'email' => 'company@example.com',
                        'inn' => '12345',
                        'payment_address' => 'company address',
                    ],
                    'items' => [
                        [
                            'name' => 'Product title 1',
                            'price' => 123.00,
                            'quantity' => 1,
                            'sum' => 123.00,
                            'payment_method' => 'full_prepayment',
                            'payment_object' => 'commodity',
                            'vat' => [
                                'type' => 'vat0'
                            ]
                        ],
                        [
                            'name' => 'Product title 2',
                            'price' => 10.00,
                            'quantity' => 2,
                            'sum' => 20.00,
                            'payment_method' => 'full_prepayment',
                            'payment_object' => 'commodity',
                            'vat' => [
                                'type' => 'vat0'
                            ]
                            ],
                    ],
                    'payments' => [
                        [
                            'type' => 1,
                            'sum' => 143.00
                        ]
                    ],
                    'total' => 143.00
                ]
            ]
        ]
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Paylink Create

[](#paylink-create-)

[Paylink Create в документации](https://api.payselection.com/#operation/Paylink%20Create)

Метод позволяет создать ссылку для перехода на платежный виджет.

```
try {
    $response = $apiClient->createPaylink([
        'MetaData' => [
            'PaymentType' => 'Pay',
            'TypeLink' => 'Reusable',
            'PreviewForm' => true,
            'SendSMS' => true,
            'OfferUrl' => 'string',
            'SendBill' => true
        ],
        'PaymentRequest' => [
            'OrderId' => 'string',
            'Amount' => '123.45',
            'Currency' => 'RUB',
            'Description' => 'string',
            'RebillFlag' => false,
            'ExtraData' => [
                'ReturnUrl' => 'https://api.payselection.com/',
                'SuccessUrl' => 'string',
                'DeclineUrl' => 'string',
                'WebhookUrl' => 'https://webhook.site/94a06b69',
                'ShortDescription' => 'string',
                'DynamicAmount' => true
            ]
        ],
        'ReceiptData' => [
            'timestamp' => 'string',
            'external_id' => 'string',
            'receipt' => [
                'client' => [
                    'name' => 'string',
                    'inn' => 'string',
                    'email' => 'string',
                    'phone' => 'string'
                ],
                'company' => [
                    'email' => 'string',
                    'sno' => 'osn',
                    'inn' => 'string',
                    'payment_address' => 'string'
                ],
                'agent_info' => [
                    'type' => 'bank_paying_agent',
                    'paying_agent' => [
                        'operation' => 'string',
                        'phones' => [
                            'string'
                        ]
                    ],
                    'receive_payments_operator' => [
                        'phones' => [
                            'string'
                        ]
                    ],
                    'money_transfer_operator' => [
                        'phones' => [
                            'string'
                        ],
                        'name' => 'string',
                        'address' => 'string',
                        'inn' => 'string'
                    ]
                ],
                'supplier_info' => [
                    'phones' => [
                        'string'
                    ]
                ],
                'items' => [
                    [
                        'name' => 'string',
                        'price' => 42949673,
                        'quantity' => 99999.999,
                        'sum' => 42949672.95,
                        'measurement_unit' => 'string',
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'nomenclature_code' => 'string',
                        'vat' => [
                            'type' => 'none',
                            'sum' => 99999999.99
                        ],
                        'agent_info' => [
                            'type' => 'bank_paying_agent',
                            'paying_agent' => [
                                'operation' => 'string',
                                'phones' => [
                                    'string'
                                ]
                            ],
                            'receive_payments_operator' => [
                                'phones' => [
                                    'string'
                                ]
                            ],
                            'money_transfer_operator' => [
                                'phones' => [
                                    'string'
                                ],
                                'name' => 'string',
                                'address' => 'string',
                                'inn' => 'string'
                            ]
                        ],
                        'supplier_info' => [
                            'phones' => [
                                'string'
                            ],
                            'name' => 'string',
                            'inn' => 'string'
                        ],
                        'user_data' => 'string',
                        'excise' => 0,
                        'country_code' => 'str',
                        'declaration_number' => 'string'
                    ]
                ],
                'payments' => [
                    [
                        'type' => 0,
                        'sum' => 99999999.99
                    ]
                ],
                'vats' => [
                    [
                        'type' => 'none',
                        'sum' => 99999999.99
                    ]
                ],
                'total' => 99999999.99,
                'additional_check_props' => 'string',
                'cashier' => 'string',
                'additional_user_props' => [
                    'name' => 'string',
                    'value' => 'string'
                ]
            ]
        ],
        'CustomerInfo' => [
            'Email' => 'user@example.com',
            'ReceiptEmail' => 'user@example.com',
            'Phone' => '+79999999999',
            'Language' => 'en',
            'Address' => 'string',
            'Town' => 'string',
            'ZIP' => 'string',
            'Country' => 'RUS',
            'UserId' => 'string'
        ],
        'RecurringData' => [
            'Amount' => '123.45',
            'Currency' => 'RUB',
            'Description' => 'string',
            'WebhookUrl' => 'https://webhook.site/94a06b69',
            'AccountId' => 'order63',
            'Email' => 'user@example.com',
            'StartDate' => '2023-01-11T13:38+0000',
            'Interval' => '5',
            'Period' => 'day',
            'MaxPeriods' => '3',
            'ReceiptData' => [
                'timestamp' => 'string',
                'external_id' => 'string',
                'receipt' => [
                    'client' => [
                        'name' => 'string',
                        'inn' => 'string',
                        'email' => 'string',
                        'phone' => 'string'
                    ],
                    'company' => [
                        'email' => 'string',
                        'sno' => 'osn',
                        'inn' => 'string',
                        'payment_address' => 'string'
                    ],
                    'agent_info' => [
                        'type' => 'bank_paying_agent',
                        'paying_agent' => [
                            'operation' => 'string',
                            'phones' => [
                                'string'
                            ]
                        ],
                        'receive_payments_operator' => [
                            'phones' => [
                                'string'
                            ]
                        ],
                        'money_transfer_operator' => [
                            'phones' => [
                                'string'
                            ],
                            'name' => 'string',
                            'address' => 'string',
                            'inn' => 'string'
                        ]
                    ],
                    'supplier_info' => [
                        'phones' => [
                            'string'
                        ]
                    ],
                    'items' => [
                        [
                            'name' => 'string',
                            'price' => 42949673,
                            'quantity' => 99999.999,
                            'sum' => 42949672.95,
                            'measurement_unit' => 'string',
                            'payment_method' => 'full_prepayment',
                            'payment_object' => 'commodity',
                            'nomenclature_code' => 'string',
                            'vat' => [
                                'type' => 'none',
                                'sum' => 99999999.99
                            ],
                            'agent_info' => [
                                'type' => 'bank_paying_agent',
                                'paying_agent' => [
                                    'operation' => 'string',
                                    'phones' => [
                                        'string'
                                    ]
                                ],
                                'receive_payments_operator' => [
                                    'phones' => [
                                        'string'
                                    ]
                                ],
                                'money_transfer_operator' => [
                                    'phones' => [
                                        'string'
                                    ],
                                    'name' => 'string',
                                    'address' => 'string',
                                    'inn' => 'string'
                                ]
                            ],
                            'supplier_info' => [
                                'phones' => [
                                    'string'
                                ],
                                'name' => 'string',
                                'inn' => 'string'
                            ],
                            'user_data' => 'string',
                            'excise' => 0,
                            'country_code' => 'str',
                            'declaration_number' => 'string'
                        ]
                    ],
                    'payments' => [
                        [
                            'type' => 0,
                            'sum' => 99999999.99
                        ]
                    ],
                    'vats' => [
                        [
                            'type' => 'none',
                            'sum' => 99999999.99
                        ]
                    ],
                    'total' => 99999999.99,
                    'additional_check_props' => 'string',
                    'cashier' => 'string',
                    'additional_user_props' => [
                        'name' => 'string',
                        'value' => 'string'
                    ]
                ]
            ]
        ],
        'ExtendedData' => [
            'FIO' => [
                'enabled' => true,
                'required' => true
            ],
            'Phone' => [
                'enabled' => true,
                'required' => true
            ],
            'Email' => [
                'enabled' => true,
                'required' => true
            ],
            'TokenLifeTime' => 10,
            'Custom' => [
                'enabled' => true,
                'required' => true,
                'name' => 'string'
            ]
        ]
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Paylink Void

[](#paylink-void-)

[Paylink Void в документации](https://api.payselection.com/#operation/Paylink%20Void)

Метод позволяет отменить ссылку на платежный виджет.

```
try {
    $response = $apiClient->createPaylinkVoid([
        'Id' => 'string'
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Get Order Status

[](#get-order-status-)

[Статус ордера в документации](https://api.payselection.com/#operation/OrderId)

Получить статус ордера по OrderId.

```
try {
    $response = $apiClient->getOrderStatus('a3a393d8-ac47-11ed-afa1-0242ac120002');
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Get Order Status (extended)

[](#get-order-status-extended-)

[Статус ордера в документации](https://api.payselection.com/#operation/OrderId%20(extended))

Расширенный запрос используется для получения информации о текущем статусе по идентификатору заказа orderId.

```
try {
    $response = $apiClient->getOrderStatusExt('a3a393d8-ac47-11ed-afa1-0242ac120002');
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Get transaction Status

[](#get-transaction-status-)

[Статус транзакции в документации](https://api.payselection.com/#operation/TransactionId)

Получить статус по TransactionId.

```
try {
    $response = $apiClient->getTransactionStatus('PS00000000000001');
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Get transaction Status (extended)

[](#get-transaction-status-extended-)

[Статус транзакции в документации](https://api.payselection.com/#operation/TransactionId%20(extended))

Расширенный запрос используется для получения информации о текущем статусе по идентификатору транзакции TransactionId.

```
try {
    $response = $apiClient->getTransactionStatusExt('PS00000000000001');
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Get transaction Status (by-dates)

[](#get-transaction-status-by-dates-)

[Статус транзакции в документации](https://api.payselection.com/#operation/Transactions%20(by-dates))

Расширенный запрос используется для получения статуса транзакций по выбранному диапазону дат.

```
try {
    $response = $apiClient->getTransactionStatusByDates([
        'StartCreationDate' => '2022-12-31T00:00:00',
        'EndCreationDate' => '2023-12-31T00:00:00',
        'PageNumber' => 1,
        'TimeZone' => 'Africa/Abidjan',
        'Statuses' => [
            'success',
            'voided',
            'preauthorized',
            'pending',
            'declined',
            'wait_for_3ds',
            'redirect'
        ]
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Create Payment

[](#create-payment-)

[Operation Pay в документации](https://api.payselection.com/#operation/Pay)

Одностадийная операция оплаты – денежные средства списываются сразу после ее проведения.

```
try {
    $response = $apiClient->createPayment([
        'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac120002',
        'Amount' => '100.00',
        'Currency' => 'RUB',
        'Description' => 'Order description',
        'RebillFlag' => false,
        'CustomerInfo' => [
            'IP' => '192.168.1.10'
        ],
        'ExtraData' => [
            'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4'
        ],
        'PaymentMethod' => 'Card',
        'ReceiptData' => [
            'timestamp' => '2023-01-11T13:38+0000',
            'external_id' => '12345678',
            'receipt' => [
                'client' => [
                    'name' => 'Inan Ivanov',
                    'email' => 'ivan@example.com',
                ],
                'company' => [
                    'email' => 'company@example.com',
                    'inn' => '12345',
                    'payment_address' => 'company address',
                ],
                'items' => [
                    [
                        'name' => 'Product title 1',
                        'price' => 123.00,
                        'quantity' => 1,
                        'sum' => 123.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                    ],
                    [
                        'name' => 'Product title 2',
                        'price' => 10.00,
                        'quantity' => 2,
                        'sum' => 20.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                        ],
                ],
                'payments' => [
                    [
                        'type' => 1,
                        'sum' => 143.00
                    ]
                ],
                'total' => 143.00
            ]
        ],
        'PaymentDetails' => [
            'CardNumber'=> '4111111111111111',
            'ExpMonth'=> '02',
            'ExpYear'=> '25',
            'CardholderName'=> 'Card Holder',
            'CVC'=> '789'
        ]
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Create Block

[](#create-block-)

[Operation Block в документации](https://api.payselection.com/#operation/Block)

Двухстадийная операция оплаты – денежные средства блокируются на карте. Если авторизация прошла успешно, необходимо завершить транзакцию в течение 5 дней, если же вы не подтвердите транзакцию запросом на списание в течение 5 дней, снятие денежных средств будет автоматически отменено. Кроме того, есть возможность задать rebillFlag для включения рекуррентных платежей.

```
try {
    $response = $apiClient->createBlock([
        'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac120002',
        'Amount' => '100.00',
        'Currency' => 'RUB',
        'Description' => 'Order description',
        'RebillFlag' => false,
        'CustomerInfo' => [
            'IP' => '192.168.1.10'
        ],
        'ExtraData' => [
            'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4'
        ],
        'PaymentMethod' => 'Card',
        'ReceiptData' => [
            'timestamp' => '2023-01-11T13:38+0000',
            'external_id' => '12345678',
            'receipt' => [
                'client' => [
                    'name' => 'Inan Ivanov',
                    'email' => 'ivan@example.com',
                ],
                'company' => [
                    'email' => 'company@example.com',
                    'inn' => '12345',
                    'payment_address' => 'company address',
                ],
                'items' => [
                    [
                        'name' => 'Product title 1',
                        'price' => 123.00,
                        'quantity' => 1,
                        'sum' => 123.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                    ],
                    [
                        'name' => 'Product title 2',
                        'price' => 10.00,
                        'quantity' => 2,
                        'sum' => 20.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                        ],
                ],
                'payments' => [
                    [
                        'type' => 1,
                        'sum' => 143.00
                    ]
                ],
                'total' => 143.00
            ]
        ],
        'PaymentDetails' => [
            'CardNumber'=> '4111111111111111',
            'ExpMonth'=> '02',
            'ExpYear'=> '25',
            'CardholderName'=> 'Card Holder',
            'CVC'=> '789'
        ]
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Rebill Payment

[](#rebill-payment-)

[Operation Rebill в документации](https://api.payselection.com/#operation/Rebill)

Операция автоматического списания средств по привязанной ранее карте.

```
try {
    $response = $apiClient->rebillPayment([
        'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac120002',
        'Amount' => '1.00',
        'Currency' => 'RUB',
        'Description' => 'Order description',
        'RebillFlag' => true,
        'RebillId' => 'GE00000001173680',
        'ReceiptData' => [
            'timestamp' => '2023-01-11T13:38+0000',
            'external_id' => '12345678',
            'receipt' => [
                'client' => [
                    'name' => 'Inan Ivanov',
                    'email' => 'ivan@example.com',
                ],
                'company' => [
                    'email' => 'company@example.com',
                    'inn' => '12345',
                    'payment_address' => 'company address',
                ],
                'items' => [
                    [
                        'name' => 'Product title 1',
                        'price' => 123.00,
                        'quantity' => 1,
                        'sum' => 123.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                    ],
                    [
                        'name' => 'Product title 2',
                        'price' => 10.00,
                        'quantity' => 2,
                        'sum' => 20.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                        ],
                ],
                'payments' => [
                    [
                        'type' => 1,
                        'sum' => 143.00
                    ]
                ],
                'total' => 143.00
            ]
        ],
        'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4'
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Confirm Payment

[](#confirm-payment-)

[Operation Confirm в документации](https://api.payselection.com/#operation/Confirm)

Используется для операций Pay или Block с 3DS после получения результатов аутентификации от банка для завершения одностадийной/двухстадийной операции оплаты.

```
try {
    $response = $apiClient->confirmPayment([
        'TransactionId' => 'PS00000000000001',
        'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac120002',
        'PaRes' => '123',
        'MD' => '456'
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Create Refund

[](#create-refund-)

[Operation Refund в документации](https://api.payselection.com/#operation/Refund)

Только успешная транзакция может быть возвращена

```
try {
    $response = $apiClient->createRefund([
        'TransactionId' => 'PS00000000000001',
        'Amount' => '1.00',
        'Currency' => 'RUB',
        'ReceiptData' => [
            'timestamp' => '2023-01-11T13:38+0000',
            'external_id' => '12345678',
            'receipt' => [
                'client' => [
                    'name' => 'Inan Ivanov',
                    'email' => 'ivan@example.com',
                ],
                'company' => [
                    'email' => 'company@example.com',
                    'inn' => '12345',
                    'payment_address' => 'company address',
                ],
                'items' => [
                    [
                        'name' => 'Product title 1',
                        'price' => 123.00,
                        'quantity' => 1,
                        'sum' => 123.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                    ],
                    [
                        'name' => 'Product title 2',
                        'price' => 10.00,
                        'quantity' => 2,
                        'sum' => 20.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                        ],
                ],
                'payments' => [
                    [
                        'type' => 1,
                        'sum' => 143.00
                    ]
                ],
                'total' => 143.00
            ]
        ],
        'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4'
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Cancel Payment

[](#cancel-payment-)

[Operation Cancel в документации](https://api.payselection.com/#operation/Cancel)

Отмена блокировки средств на карте в рамках ранее проведенной двухстадийной операции оплаты.

```
try {
    $response = $apiClient->cancelPayment([
            'TransactionId' => 'PS00000000000001',
            'Amount' => '100.00',
            'Currency' => 'RUB',
            'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4'
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Charge Payment

[](#charge-payment-)

[Operation Charge в документации](https://api.payselection.com/#operation/Charge)

Списание средств с карты в рамках проведенной ранее двухстадийной операции оплаты.

```
try {
    $response = $apiClient->chargePayment([
        'TransactionId' => 'PS00000000000001',
        'Amount' => '100.00',
        'Currency' => 'RUB',
        'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4'
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Cancel Subscription

[](#cancel-subscription-)

[Operation Unsubscribe в документации](https://api.payselection.com/#operation/Unsubscribe)

Отмена рекуррентных платежей.При использовании данного метода произойдет отписка по всем зарегистрированным регулярным оплатам в рамках переданного RebillId

```
try {
    $response = $apiClient->cancelSubscription([
        'RebillId' => 'PS00000000000001'
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Create Payout

[](#create-payout-)

[Operation Payout в документации](https://api.payselection.com/#operation/Payout)

Одностадийная операция оплаты – денежные средства списываются сразу после ее проведения.

```
try {
    $response = $apiClient->createPayout([
        'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac120002',
        'Amount' => '100.00',
        'Currency' => 'RUB',
        'Description' => 'Order description',
        'CustomerInfo' => [
            'IP' => '192.168.1.10'
        ],
        'ExtraData' => [
            'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4'
        ],
        'PayoutMethod' => 'Card',
        'ReceiptData' => [
            'timestamp' => '2023-01-11T13:38+0000',
            'external_id' => '12345678',
            'receipt' => [
                'client' => [
                    'name' => 'Inan Ivanov',
                    'email' => 'ivan@example.com',
                ],
                'company' => [
                    'email' => 'company@example.com',
                    'inn' => '12345',
                    'payment_address' => 'company address',
                ],
                'items' => [
                    [
                        'name' => 'Product title 1',
                        'price' => 123.00,
                        'quantity' => 1,
                        'sum' => 123.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                    ],
                    [
                        'name' => 'Product title 2',
                        'price' => 10.00,
                        'quantity' => 2,
                        'sum' => 20.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                        ],
                ],
                'payments' => [
                    [
                        'type' => 1,
                        'sum' => 143.00
                    ]
                ],
                'total' => 143.00
            ]
        ],
        'PayoutDetails' => [
            'CardNumber'=> '4111111111111111',
            'CardholderName'=> 'Card Holder',
        ]
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Get Balance

[](#get-balance-)

[Operation Balance в документации](https://api.payselection.com/#operation/Balance)

Операция проверки доступного баланса для Payout.

```
try {
    $response = $apiClient->getBalance();
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Register Recurring

[](#register-recurring-)

[Operation Recurring в документации](https://api.payselection.com/#operation/Recurring)

Регистрация регулярной оплаты по привязанной ранее карте.

```
try {
    $response = $apiClient->registerRecurring([
        'RebillId' => 'GE00000001173680',
        'Amount' => '100.00',
        'Currency' => 'RUB',
        'Description' => 'Recurring description',
        'WebhookUrl' => 'https://webhook.site/f2bea4b3-e85c-40e9-9587-b588cfda84d3',
        'AccountId' => 'order63',
        'Email' => 'user@example.com',
        'StartDate' => '2023-05-11T13:38+0000',
        'Interval' => '5',
        'Period' => 'day',
        'MaxPeriods' => '3',
        'ReceiptData' => [
            'timestamp' => '2023-01-11T13:38+0000',
            'external_id' => '12345678',
            'receipt' => [
                'client' => [
                    'name' => 'Inan Ivanov',
                    'email' => 'ivan@example.com',
                ],
                'company' => [
                    'email' => 'company@example.com',
                    'inn' => '12345',
                    'payment_address' => 'company address',
                ],
                'items' => [
                    [
                        'name' => 'Product title 1',
                        'price' => 123.00,
                        'quantity' => 1,
                        'sum' => 123.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                    ],
                    [
                        'name' => 'Product title 2',
                        'price' => 10.00,
                        'quantity' => 2,
                        'sum' => 20.00,
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'vat' => [
                            'type' => 'vat0'
                        ]
                        ],
                ],
                'payments' => [
                    [
                        'type' => 1,
                        'sum' => 143.00
                    ]
                ],
                'total' => 143.00
            ]
        ]
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Cancel Recurring

[](#cancel-recurring-)

[Operation Recurring Unsubscribe в документации](https://api.payselection.com/#operation/Recurring%20Unsubscribe)

Отмена регулярной оплаты.

```
try {
    $response = $apiClient->cancelRecurring([
        'RecurringId' => '1173'
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Search Recurring

[](#search-recurring-)

[Operation Recurring Search в документации](https://api.payselection.com/#operation/Recurring%20Search)

Поиск регулярной оплаты (подписки) по выбранному параметру.

```
try {
    $response = $apiClient->searchRecurring([
        'RebillId' => 'PS00000000000001',
        'RecurringId' => '1173',
        'AccountId' => 'order63',
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

### Change Recurring

[](#change-recurring-)

[Operation Recurring Change в документации](https://api.payselection.com/#operation/Recurring%20Change)

Изменение параметров регулярной оплаты (подписки).

```
try {
    $response = $apiClient->changeRecurring([
        'RecurringId' => '1173',
        'MaxPeriods' => '3',
        'StartDate' => '2023-01-11T13:38+0000',
        'Interval' => '5',
        'Period' => 'day',
        'Amount' => '123.45',
        'ReceiptData' => [
            'timestamp' => 'string',
            'external_id' => 'string',
            'receipt' => [
                'client' => [
                    'name' => 'string',
                    'inn' => 'string',
                    'email' => 'string',
                    'phone' => 'string'
                ],
                'company' => [
                    'email' => 'string',
                    'sno' => 'osn',
                    'inn' => 'string',
                    'payment_address' => 'string'
                ],
                'agent_info' => [
                    'type' => 'bank_paying_agent',
                    'paying_agent' => [
                        'operation' => 'string',
                        'phones' => [
                            'string'
                        ]
                    ],
                    'receive_payments_operator' => [
                        'phones' => [
                            'string'
                        ]
                    ],
                    'money_transfer_operator' => [
                        'phones' => [
                            'string'
                        ],
                        'name' => 'string',
                        'address' => 'string',
                        'inn' => 'string'
                    ]
                ],
                'supplier_info' => [
                    'phones' => [
                        'string'
                    ]
                ],
                'items' => [
                    [
                        'name' => 'string',
                        'price' => 42949673,
                        'quantity' => 99999.999,
                        'sum' => 42949672.95,
                        'measurement_unit' => 'string',
                        'payment_method' => 'full_prepayment',
                        'payment_object' => 'commodity',
                        'nomenclature_code' => 'string',
                        'vat' => [
                            'type' => 'none',
                            'sum' => 99999999.99
                        ],
                        'agent_info' => [
                            'type' => 'bank_paying_agent',
                            'paying_agent' => [
                                'operation' => 'string',
                                'phones' => [
                                    'string'
                                ]
                            ],
                            'receive_payments_operator' => [
                                'phones' => [
                                    'string'
                                ]
                            ],
                            'money_transfer_operator' => [
                                'phones' => [
                                    'string'
                                ],
                                'name' => 'string',
                                'address' => 'string',
                                'inn' => 'string'
                            ]
                        ],
                        'supplier_info' => [
                            'phones' => [
                                'string'
                            ],
                            'name' => 'string',
                            'inn' => 'string'
                        ],
                        'user_data' => 'string',
                        'excise' => 0,
                        'country_code' => 'str',
                        'declaration_number' => 'string'
                    ]
                ],
                'payments' => [
                    [
                        'type' => 0,
                        'sum' => 99999999.99
                    ]
                ],
                'vats' => [
                    [
                        'type' => 'none',
                        'sum' => 99999999.99
                    ]
                ],
                'total' => 99999999.99,
                'additional_check_props' => 'string',
                'cashier' => 'string',
                'additional_user_props' => [
                    'name' => 'string',
                    'value' => 'string'
                ]
            ]
        ]
    ]);
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($response);
```

Работа с webhooks
------------------------------------------------------

[](#работа-с-webhooks-)

[Webhook в документации](https://api.payselection.com/#operation/Webhooks)[Webhook для подписок в документации](https://api.payselection.com/#tag/webhooks-dlya-podpisok)

```
try {
    $result = $apiClient->hookPay();
} catch (\Exception $e) {
    $response = $e->getMessage();
}

var_dump($result);
```

Работа с webhooks проверки платежа
--------------------------------------------------------------------------------------

[](#работа-с-webhooks-проверки-платежа-)

[Webhook для проверки платежа в документации](https://api.payselection.com/#tag/Webhook-proverki-platezha)

После ввода клиентом карточных данных вы можете получить webhook с данными из запроса для сопоставления их с данными заказа. Вебхук проверки платежа отличается от обычного вебхука, в котором ТСП получает результаты платежа, после его проведения. Вебхук проверки платежа активируется только технической поддержкой. Чтобы включить, настроить и выключить вебхук проверки платежа необходимо написать на почту .

В письме сообщите:

1. URL-адрес возврата, куда будет передаваться вебхук. Также вы можете заранее самостоятельно настроить статичный URL возврата в личном кабинете, в разделе "Сайты". Укажите его для тех.поддержки.
2. Параметры из запроса, которые вам необходимо проверить (это всё, что входит в payment request в методе create)

Возможные варианты параметров для проверки:

- сумма
- номер заказа
- валюта платежа

Проверочный вебхук отправляется с webpay после ввода карточных данных или выбора клиентом иного способа оплаты. Вебхук проверки платежа приходит в формате json и содержит только те параметры для проверки, которые вы указали в письме

Пример содержимого полученного вебхука: {"OrderId": "1299670125", "Amount": "4.50", "Description": "Description", "RebillFlag": false}

После подключения вебхука проверки платежа, когда вы направите запрос с необходимыми параметрами и URL возврата, Ваш сервис приема должен отдавать:

1. 200 статус, если оплату можно продолжать
2. 4хх и 5хх статусы в различных вариациях для прерывания оплаты.

```
try {
    $result = $apiClient->verifyPaymentHook();
    // Пример проверки суммы
    if ($result->amount != 500) throw new Exception("Incorrect amount");
} catch (\PaySelection\Exceptions\PSException $e) {
    print_r($e);
}

var_dump($result);
```

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55.9% 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 ~30 days

Total

13

Last Release

537d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/42aa78b17308500e4dbb81983947de71b07e489af60844263d44669c2e11d96a?d=identicon)[Vadim Beletsky](/maintainers/Vadim%20Beletsky)

---

Top Contributors

[![Lektor-zz](https://avatars.githubusercontent.com/u/2536075?v=4)](https://github.com/Lektor-zz "Lektor-zz (52 commits)")[![RitaTapero](https://avatars.githubusercontent.com/u/84068986?v=4)](https://github.com/RitaTapero "RitaTapero (28 commits)")[![sl-and](https://avatars.githubusercontent.com/u/56913071?v=4)](https://github.com/sl-and "sl-and (13 commits)")

---

Tags

payselection apipayselection

### Embed Badge

![Health badge](/badges/payselection-payselection-php-client/health.svg)

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

###  Alternatives

[netflie/whatsapp-cloud-api

The first PHP SDK to send and receive messages using a cloud-hosted version of the WhatsApp Business Platform

640431.7k4](/packages/netflie-whatsapp-cloud-api)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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