PHPackages                             dmitriidigital/laravel-unitpay - 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. dmitriidigital/laravel-unitpay

ActiveLibrary

dmitriidigital/laravel-unitpay
==============================

UnitPay payments for Laravel

0161PHP

Since May 8Pushed 3y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel payment processor package for UnitPay gateway
=====================================================

[](#laravel-payment-processor-package-for-unitpay-gateway)

[![Latest Stable Version](https://camo.githubusercontent.com/cad5e0b0223e41d7be60d51ff26acdfa1de268cf669fd34b43645a4a076b1279/68747470733a2f2f706f7365722e707567782e6f72672f646d69747269696469676974616c2f6c61726176656c2d756e69747061792f762f737461626c65)](https://packagist.org/packages/dmitriidigital/laravel-unitpay)[![Build Status](https://camo.githubusercontent.com/2b8040c0d8ffc8fd578e9dd7917af1999cd17aebfeb71b783438a6ed093c19e3/68747470733a2f2f7472617669732d63692e6f72672f646d69747269696469676974616c2f6c61726176656c2d756e69747061792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dmitriidigital/laravel-unitpay)[![StyleCI](https://camo.githubusercontent.com/d7668402b62ede7e1ce774af8ce3068b5ed947a5f9f11d562638937bf6c639bf/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136353834313630312f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/165841601)[![CodeFactor](https://camo.githubusercontent.com/3442aa28aa0e3c212799c404488f449d436d204bc291915da6f6621c893f27c4/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f646d69747269696469676974616c2f6c61726176656c2d756e69747061792f6261646765)](https://www.codefactor.io/repository/github/dmitriidigital/laravel-unitpay)[![Total Downloads](https://camo.githubusercontent.com/ab4345d54298e10e98ad6423db362dad5fc73ddb72d90bc5481f97d959862ba9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646d69747269696469676974616c2f6c61726176656c2d756e69747061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dmitriidigital/laravel-unitpay)[![License](https://camo.githubusercontent.com/32d87b4f5e540c87ba498ee25a30cb760c32b3db6ad9f5af0f2842dfd6c5368b/68747470733a2f2f706f7365722e707567782e6f72672f646d69747269696469676974616c2f6c61726176656c2d756e69747061792f6c6963656e7365)](https://packagist.org/packages/dmitriidigital/laravel-unitpay)

Accept payments via UnitPay ([unitpay.ru](https://unitpay.ru/)) using this Laravel framework package ([Laravel](https://laravel.com)).

- receive payments, adding just the two callbacks

#### Laravel &gt;= 8.\*, PHP &gt;= 7.3

[](#laravel--8-php--73)

> To use the package for Laravel 7.\* use the [3.x](https://github.com/dmitriidigital/laravel-unitpay/tree/3.x) branch

> To use the package for Laravel 6.\* use the [2.x](https://github.com/dmitriidigital/laravel-unitpay/tree/2.x) branch

> To use the package for Laravel 5.\* use the [1.x](https://github.com/dmitriidigital/laravel-unitpay/tree/1.x) branch

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

[](#installation)

Require this package with composer.

```
composer require "dmitriidigital/laravel-unitpay"
```

If you don't use auto-discovery, add the ServiceProvider to the providers array in `config/app.php`

```
Dmitriidigital\UnitPay\UnitPayServiceProvider::class,
```

Add the `UnitPay` facade to your facades array:

```
'UnitPay' => Dmitriidigital\UnitPay\Facades\UnitPay::class,
```

Copy the package config to your local config with the publish command:

```
php artisan vendor:publish --provider="Dmitriidigital\UnitPay\UnitPayServiceProvider"
```

Configuration
-------------

[](#configuration)

Once you have published the configuration files, please edit the config file in `config/unitpay.php`.

- Create an account on [unitpay.ru](http://unitpay.ru)
- Add your project, copy the `public_key`, `secret_key` params and paste into `config/unitpay.php`
- After the configuration has been published, edit `config/unitpay.php`
- Set the callback static function for `searchOrder` and `paidOrder`
- Create route to your controller, and call `UnitPay::handle` method

Usage
-----

[](#usage)

1. Generate a payment url or get redirect:

```
$amount = 100; // Payment`s amount

$email = "example@gmail.com"; // Your customer`s email

$description = "Test payment";

//

$url = UnitPay::getPayUrl($amount, $order_id, $email, $description, $currency);

$redirect = UnitPay::redirectToPayUrl($amount, $order_id, $email, $description, $currency);
```

2. Process the request from UnitPay:

```
UnitPay::handle(Request $request)
```

Important
---------

[](#important)

You must define callbacks in `config/unitpay.php` to search the order and save the paid order.

```
'searchOrder' => null  // UnitPayController@searchOrder(Request $request)
```

```
'paidOrder' => null  // UnitPayController@paidOrder(Request $request, $order)
```

Example
-------

[](#example)

The process scheme:

1. The request comes from `unitpay.ru` `GET` `http://yourproject.com/unitpay/result` (with params).
2. The function`UnitPayController@handlePayment` runs the validation process (auto-validation request params).
3. The method `searchOrder` will be called (see `config/unitpay.php` `searchOrder`) to search the order by the unique id.
4. If the current order status is NOT `paid` in your database, the method `paidOrder` will be called (see `config/unitpay.php` `paidOrder`).

Add the route to `routes/web.php`:

```
 Route::get('/unitpay/result', 'UnitPayController@handlePayment');
```

> **Note:**don't forget to save your full route url (e.g.  ) for your project on [unitpay.ru](unitpay.ru).

Create the following controller: `/app/Http/Controllers/UnitPayController.php`:

```
class UnitPayController extends Controller
{
    /**
     * Search the order in your database and return that order
     * to paidOrder, if status of your order is 'paid'
     *
     * @param Request $request
     * @param $order_id
     * @return bool|mixed
     */
    public function searchOrder(Request $request, $order_id)
    {
        $order = Order::where('id', $order_id)->first();

        if($order) {
            $order['_orderSum'] = $order->sum;

            // If your field can be `paid` you can set them like string
            $order['_orderStatus'] = $order['status'];

            // Else your field doesn` has value like 'paid', you can change this value
            $order['_orderStatus'] = ('1' == $order['status']) ? 'paid' : false;

            return $order;
        }

        return false;
    }

    /**
     * When paymnet is check, you can paid your order
     *
     * @param Request $request
     * @param $order
     * @return bool
     */
    public function paidOrder(Request $request, $order)
    {
        $order->status = 'paid';
        $order->save();

        //

        return true;
    }

    /**
     * Start handle process from route
     *
     * @param Request $request
     * @return mixed
     */
    public function handlePayment(Request $request)
    {
        return UnitPay::handle($request);
    }
}
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please send me an email at  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Dmitriidigital](https://github.com/dmitriidigital)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 83.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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b57c7a99330d22bfd0d6ec9bc88c285666d42ff916d73a3db0f3b48d2e4441de?d=identicon)[dmitriidigital](/maintainers/dmitriidigital)

---

Top Contributors

[![maksa988](https://avatars.githubusercontent.com/u/5982466?v=4)](https://github.com/maksa988 "maksa988 (30 commits)")[![dmitriidigital](https://avatars.githubusercontent.com/u/102148908?v=4)](https://github.com/dmitriidigital "dmitriidigital (3 commits)")[![jasonstealer](https://avatars.githubusercontent.com/u/87783247?v=4)](https://github.com/jasonstealer "jasonstealer (3 commits)")

### Embed Badge

![Health badge](/badges/dmitriidigital-laravel-unitpay/health.svg)

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

PHPackages © 2026

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