PHPackages                             daaner/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. [Payment Processing](/categories/payments)
4. /
5. daaner/laravel-unitpay

ActiveLibrary[Payment Processing](/categories/payments)

daaner/laravel-unitpay
======================

UnitPay payments for Laravel

8.0(4y ago)058MITPHPPHP &gt;=7.1.3

Since Mar 16Pushed 4y ago1 watchersCompare

[ Source](https://github.com/daaner/laravel-unitpay)[ Packagist](https://packagist.org/packages/daaner/laravel-unitpay)[ Docs](https://github.com/daaner/laravel-unitpay)[ RSS](/packages/daaner-laravel-unitpay/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

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

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

[![Total Downloads](https://camo.githubusercontent.com/abc38901b18f36610cc646e75b7b831df7bf564296d151c3c9c037832fec075d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6461616e65722f6c61726176656c2d756e69747061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/daaner/laravel-unitpay)[![License](https://camo.githubusercontent.com/a6781be94609ea44935dd6e56618bccc60c868002466041abfb963725ca4e538/68747470733a2f2f706f7365722e707567782e6f72672f6461616e65722f6c61726176656c2d756e69747061792f6c6963656e7365)](https://packagist.org/packages/daaner/laravel-unitpay)

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

Based on [ActionM](https://github.com/actionm/laravel-unitpay)

- receive payments, adding just the two callbacks
- receive payment notifications via your email or Slack

You can accept payments with Unitpay via Yandex.Money, QIWI, WebMoney, PayPal, credit cards etc.

#### Laravel 5.5+, PHP &gt;= 7.1+

[](#laravel-55-php--71)

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

[](#installation)

You can install the package through Composer:

```
composer require daaner/laravel-unitpay
```

Add the service provider to the `providers` array in `config/app.php`:

```
'providers' => [

    Daaner\UnitPay\UnitPayServiceProvider::class,

]
```

Add the `UnitPay` facade to your facades array:

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

Publish the configuration file and views

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

Publish only the configuration file

```
php artisan vendor:publish --provider="Daaner\UnitPay\UnitPayServiceProvider" --tag=config
```

Publish only the views

```
php artisan vendor:publish --provider="Daaner\UnitPay\UnitPayServiceProvider" --tag=views
```

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` and `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 `searchOrderFilter` and `paidOrderFilter`
- Set notification channels (email and/or Slack) and Slack `webhook_url`

Usage
-----

[](#usage)

1. Generate an HTML payment form with enabled payment methods:

```
$payment_amount = Order amount

$payment_no = Unique order ID in your project

$user_email = User email

$item_name = Name of your order item

$currency =  'RUB' or 'UAH','BYR','EUR','USD'
```

```
UnitPay::generatePaymentForm($payment_amount, $payment_no, $user_email, $item_name, $currency);
```

Customize the HTML payment form in the published view:

`app/resources/views/vendor/unitpay/payment_form.blade.php`

2. Process the request from UnitPay:

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

Important
---------

[](#important)

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

```
 'searchOrderFilter' => null  // ExampleController:searchOrderFilter($request)
```

```
 'paidOrderFilter' => null  // ExampleController::paidOrderFilter($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`ExampleController@payOrderFromGate` runs the validation process (auto-validation request params).
3. The static function `searchOrderFilter` will be called (see `config/unitpay.php` `searchOrderFilter`) to search the order by the unique id.
4. If the current order status is NOT `paid` in your database, the static function `paidOrderFilter` will be called (see `config/unitpay.php` `paidOrderFilter`).

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

```
 Route::get('/unitpay/result', 'ExampleController@payOrderFromGate');
```

> **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/ExampleController.php`:

```
class ExampleController extends Controller
{

    /**
     * Search the order if the request from unitpay is received.
     * Return the order with required details for the unitpay request verification.
     *
     * @param Request $request
     * @param $order_id
     * @return mixed
     */
    public static function searchOrderFilter(Request $request, $order_id) {

        // If the order with the unique order ID exists in the database
        $order = Order::where('unique_id', $order_id)->first();

        if ($order) {
            $order['UNITPAY_orderSum'] = $order->amount; // from your database
            $order['UNITPAY_orderCurrency'] = 'RUB';  // from your database

            // if the current_order is already paid in your database, return strict "paid";
            // if not, return something else
            $order['UNITPAY_orderStatus'] = $order->order_status; // from your database
            return $order;
        }

        return false;
    }

    /**
     * When the payment of the order is received from unitpay, you can process the paid order.
     * !Important: don't forget to set the order status as "paid" in your database.
     *
     * @param Request $request
     * @param $order
     * @return bool
     */
    public static function paidOrderFilter(Request $request, $order)
    {
        // Your code should be here:
        YourOrderController::saveOrderAsPaid($order);

        // Return TRUE if the order is saved as "paid" in the database or FALSE if some error occurs.
        // If you return FALSE, then you can repeat the failed paid requests on the unitpay website manually.
        return true;
    }

    /**
     * Process the request from the UnitPay route.
     * searchOrderFilter is called to search the order.
     * If the order is paid for the first time, paidOrderFilter is called to set the order status.
     * If searchOrderFilter returns the "paid" order status, then paidOrderFilter will not be called.
     *
     * @param Request $request
     * @return mixed
     */
    public function payOrderFromGate(Request $request)
    {
        return UnitPay::payOrderFromGate($request);
    }
```

Changelog
---------

[](#changelog)

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

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

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

Credits
-------

[](#credits)

- [ActionM](https://github.com/actionm)
- [Daan](https://github.com/daaner)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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 ~228 days

Total

3

Last Release

1790d ago

Major Versions

6.0.1 → 8.02021-06-14

### Community

Maintainers

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

---

Top Contributors

[![daaner](https://avatars.githubusercontent.com/u/9641698?v=4)](https://github.com/daaner "daaner (12 commits)")

---

Tags

paymentsunitpaylaravel-unitpay

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[unicodeveloper/laravel-paystack

A Laravel Package for Paystack

650975.6k11](/packages/unicodeveloper-laravel-paystack)[chargebee/chargebee-php

ChargeBee API client implementation for PHP

768.0M9](/packages/chargebee-chargebee-php)[lemonsqueezy/laravel

A package to easily integrate your Laravel application with Lemon Squeezy.

58596.1k](/packages/lemonsqueezy-laravel)[mnastalski/przelewy24-php

Przelewy24 PHP library

52101.2k2](/packages/mnastalski-przelewy24-php)[tsaiyihua/laravel-linepay

linepay library for laravel

102.9k](/packages/tsaiyihua-laravel-linepay)

PHPackages © 2026

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