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

ActiveLibrary[Payment Processing](/categories/payments)

maksa988/laravel-unitpay
========================

UnitPay payments for Laravel

v4.0.0(5y ago)1392313MITPHPPHP ^7.3|^8.0CI failing

Since Jan 15Pushed 5y ago2 watchersCompare

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

READMEChangelog (6)Dependencies (4)Versions (14)Used By (0)

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

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

[![Latest Stable Version](https://camo.githubusercontent.com/7e86018133eb1e28eafe875b86d90cc7748027c2c1c242e0fe0464d36daddd4e/68747470733a2f2f706f7365722e707567782e6f72672f6d616b73613938382f6c61726176656c2d756e69747061792f762f737461626c65)](https://packagist.org/packages/maksa988/laravel-unitpay)[![Build Status](https://camo.githubusercontent.com/cc5eec8625b48e555d95fc8f7cd8b3543096911b09134a3b2cb7d2218778b828/68747470733a2f2f7472617669732d63692e6f72672f6d616b73613938382f6c61726176656c2d756e69747061792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/maksa988/laravel-unitpay)[![StyleCI](https://camo.githubusercontent.com/d7668402b62ede7e1ce774af8ce3068b5ed947a5f9f11d562638937bf6c639bf/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136353834313630312f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/165841601)[![CodeFactor](https://camo.githubusercontent.com/9648579a9184b529763c7382c1c84a25dbf433b760b10d0fb2b8858e6cd38ce4/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f6d616b73613938382f6c61726176656c2d756e69747061792f6261646765)](https://www.codefactor.io/repository/github/maksa988/laravel-unitpay)[![Total Downloads](https://camo.githubusercontent.com/5b915eff11c20dd9f0019ffdb39747f90ae06d7e844109734804ab4adff62aeb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d616b73613938382f6c61726176656c2d756e69747061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/maksa988/laravel-unitpay)[![License](https://camo.githubusercontent.com/fa65dbd7f55abea7d3c503466ec2aef5eaf5475520e3d293918b7074c70ddd68/68747470733a2f2f706f7365722e707567782e6f72672f6d616b73613938382f6c61726176656c2d756e69747061792f6c6963656e7365)](https://packagist.org/packages/maksa988/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/maksa988/laravel-unitpay/tree/3.x) branch

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

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

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

[](#installation)

Require this package with composer.

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

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

```
Maksa988\UnitPay\UnitPayServiceProvider::class,
```

Add the `UnitPay` facade to your facades array:

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

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

```
php artisan vendor:publish --provider="Maksa988\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)

- [Maksa988](https://github.com/maksa988)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity73

Established project with proven stability

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

Recently: every ~81 days

Total

9

Last Release

1915d ago

Major Versions

1.x-dev → 2.x-dev2020-05-13

v2.0.0 → v3.0.02020-05-13

v3.0.0 → v4.0.02021-04-02

PHP version history (5 changes)v1.0.0PHP &gt;=5.6.4

v1.0.2PHP &gt;=7.1

2.x-devPHP &gt;=7.2

v3.0.0PHP &gt;=7.2.5

v4.0.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/20fbc1e64ffeb6456030e392c1f59eb47a5e9dbb4406aa117ce2a343a4c9f1ba?d=identicon)[maksa988](/maintainers/maksa988)

---

Top Contributors

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

---

Tags

accept-paymentslaravellaravel-5-packagelaravel-paymentslaravel-unitpayunitpay

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.6M218](/packages/backpack-crud)[statamic/cms

The Statamic CMS Core Package

4.8k3.5M925](/packages/statamic-cms)[unopim/unopim

UnoPim Laravel PIM

10.5k2.2k](/packages/unopim-unopim)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3310.1k](/packages/duncanmcclean-statamic-cargo)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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