PHPackages                             zkelo/unitpay-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. zkelo/unitpay-sdk

AbandonedArchivedLibrary[API Development](/categories/api)

zkelo/unitpay-sdk
=================

Unitpay SDK

1.0.3-beta(4y ago)034MITPHPPHP ^7.1

Since Apr 27Pushed 4y agoCompare

[ Source](https://github.com/zkelo/unitpay-sdk)[ Packagist](https://packagist.org/packages/zkelo/unitpay-sdk)[ RSS](/packages/zkelo-unitpay-sdk/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

Unitpay PHP SDK
===============

[](#unitpay-php-sdk)

[![Packagist PHP Version Support](https://camo.githubusercontent.com/fed2c8f7be3d6333d54f5aae1d3dbae8a2437ef2a67668efb00c5f6ed965da01/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7a6b656c6f2f756e69747061792d73646b)](https://camo.githubusercontent.com/fed2c8f7be3d6333d54f5aae1d3dbae8a2437ef2a67668efb00c5f6ed965da01/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7a6b656c6f2f756e69747061792d73646b)[![CodeFactor Grade](https://camo.githubusercontent.com/8719e4325b539705d01885dbb47dac9256a19853092c004cc8eaedc5a29732df/68747470733a2f2f696d672e736869656c64732e696f2f636f6465666163746f722f67726164652f6769746875622f7a6b656c6f2f756e69747061792d73646b)](https://camo.githubusercontent.com/8719e4325b539705d01885dbb47dac9256a19853092c004cc8eaedc5a29732df/68747470733a2f2f696d672e736869656c64732e696f2f636f6465666163746f722f67726164652f6769746875622f7a6b656c6f2f756e69747061792d73646b)[![Packagist Downloads](https://camo.githubusercontent.com/5599d3fef94b7ba7fd7e0a4c1574089d9b98865a7fa999fa1fc726c281fd9eb7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a6b656c6f2f756e69747061792d73646b)](https://camo.githubusercontent.com/5599d3fef94b7ba7fd7e0a4c1574089d9b98865a7fa999fa1fc726c281fd9eb7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a6b656c6f2f756e69747061792d73646b)[![Packagist License](https://camo.githubusercontent.com/60773ad699c279f99937bb70ac102c2cbd5c7fb95e5f07301ffeec78f9d91271/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a6b656c6f2f756e69747061792d73646b)](https://camo.githubusercontent.com/60773ad699c279f99937bb70ac102c2cbd5c7fb95e5f07301ffeec78f9d91271/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7a6b656c6f2f756e69747061792d73646b)

This SDK allows you to work with Unitpay payment system on PHP.

Manual
======

[](#manual)

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

[](#requirements)

- PHP 7.1 or newer;
- Composer.

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

[](#installation)

```
composer require zkelo/unitpay-sdk

```

Initial configuration
---------------------

[](#initial-configuration)

SDK constructor requires at least two arguments to be passed in - it's your secret and public key. Optional third argument is domain name that will be used to interact with.

```
use zkelo\Unitpay\Unitpay;

$secretKey = 'Your secret key';
$publicKey = 'Your public key';

$sdk = new Unitpay($secretKey, $publicKey);
```

Quick start
-----------

[](#quick-start)

### Creating payment form link

[](#creating-payment-form-link)

Following example creates payment form link and redirects user to it immediately.

```
// Order amount
$amount = 5;

// Order ID
$orderId = 161;

// Order description
$description = "Order $orderId (test)";

// Creating form link
$url = $sdk->form($amount, $orderId, $description);

// Redirecting user to form
header("Location: $url");
```

### Hanling incoming request

[](#hanling-incoming-request)

Next example handles incoming Unitpay request using SDK and returns correspond response (even if request is bad).

```
// Retrieving IP
$remoteIp = $_SERVER['REMOTE_ADDR'];

// Retrieving request data from `$_GET` array using `filter_input()` function
$requestData = filter_input_array(INPUT_GET);

// Handling request using SDK
$response = $sdk->handleRequest($remoteIp, $requestData, $success);

// Returning response
echo json_encode($response);
```

> **Be aware!** SDK method returns array you must encode to JSON so you need to use `json_encode()` function.

If you need to do something on success or fail request you can use third argument passed to method which reference to variable that will be used to store boolean value about request status.

As you can see in example above we passed `$success` variable as third argument to method so we can easy check request status.

```
// ...

// Handling request using SDK
$response = $sdk->handleRequest($remoteIp, $requestData, $success);

if ($success) {
    // Do something on success request
} else {
    // Do something on bad request
}

// Returning response
echo json_encode($response);
```

### Creating payment by API request

[](#creating-payment-by-api-request)

Sometimes you need to init payment through request to API instead of using Unitpay form.

```
// Order amount
$amount = 5;

// Order ID
$orderId = 161;

// Order description
$description = "Order $orderId (test)";

// User IP (can be either IPv4 or IPv6)
$ip = '127.0.0.1';

// Creating payment
$paymentId = $sdk->initPayment('card', $orderId, $amount, $description, $ip);
```

> In example above payment method written as is, e.g. "raw". But instead of writing payment method by hand you can use constants from models. Please refer to [models](#models) section for more information.

### Retrieving information about payment

[](#retrieving-information-about-payment)

To retrieve payment information you should use `getPayment()` method that returns information in comfortable way using model.

```
// Payment ID in Unitpay (this is not order ID in your app or something else!)
$paymentId = 7777777777;

// Retrieving information
$paymentInfo = $sdk->getPayment($paymentId);

// Display order amount and currency
echo "Order amount: $paymentInfo->orderSum (currency: $paymentInfo->orderCurrency)", PHP_EOL;
```

### Localization

[](#localization)

- *ToDo.*

Reference
=========

[](#reference)

*This section will be written soon.*

Exceptions
----------

[](#exceptions)

- *ToDo.*

Interfaces
----------

[](#interfaces)

- *ToDo.*

Available methods
-----------------

[](#available-methods)

- *ToDo.*

Locales
-------

[](#locales)

- *ToDo.*

Models
------

[](#models)

- *ToDo.*

Extending
=========

[](#extending)

Localization
------------

[](#localization-1)

If you need to translate currency names, payment methods or response messages to your language you can do it simply by making new locale class which extending base abstract `Locale` class.

Example below shows how looks locale class.

```
namespace App\Locales;

/**
 * My own locale
 */
class MyLocale extends Locale implements LocaleInterface
{
    /**
     * {@inheritDoc}
     */
    public static function messages(): array
    {
        return [
            // Write translations here.
            //
            // For example, if you want to translate some currencies names,
            // you just need to specify all its messages inside `currency` property
            // which will be array which has currencies IDs as keys
            // and translation messages for each of them as values.
            'currency' => [
                // Don't use raw names of currencies,
                // payment methods and etc. in your
                // locale class like here:
                //
                'RUB' => 'Russian rouble', //  'Russian rouble' // setDefaultLocale('en_GB');

// Or... specifying locale in "real-time"
$sdk->form(10, 6, 'Test payment', zkelo\Unitpay\Models\Payment::METHOD_CARD, zkelo\Unitpay\Models\Currency::RUB, 'en_GB');
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

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.

###  Release Activity

Cadence

Every ~4 days

Total

4

Last Release

1824d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9fb4f1d62f624b6e9f80554f3d126fb5643ae9ea3b8d562ac10e884a8ebe0821?d=identicon)[ZKelo](/maintainers/ZKelo)

---

Top Contributors

[![zkelo](https://avatars.githubusercontent.com/u/13527447?v=4)](https://github.com/zkelo "zkelo (108 commits)")

---

Tags

apiphpsdkunitpayunitpay-apiphpsdkunitpay

### Embed Badge

![Health badge](/badges/zkelo-unitpay-sdk/health.svg)

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

###  Alternatives

[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[jstolpe/instagram-graph-api-php-sdk

Instagram Graph API PHP SDK

13998.4k2](/packages/jstolpe-instagram-graph-api-php-sdk)[octw/aramex

A Library to integrate with Aramex APIs

2925.2k](/packages/octw-aramex)[jeffreyhyer/bamboohr

PHP SDK for the BambooHR API

1077.3k1](/packages/jeffreyhyer-bamboohr)

PHPackages © 2026

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