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

ActiveLibrary[Payment Processing](/categories/payments)

rekkopavel/laravel-unitpay
==========================

UnitPay payments for Laravel

024PHP

Since May 21Pushed 2y agoCompare

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

READMEChangelog (1)DependenciesVersions (3)Used By (0)

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

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

[![Latest Stable Version](https://camo.githubusercontent.com/15a1003e2424b57b18f720386735e81bb987fc3e243dead53040efbbf156f72e/68747470733a2f2f706f7365722e707567782e6f72672f52656b6b6f506176656c2f6c61726176656c2d756e69747061792f762f737461626c65)](https://packagist.org/packages/RekkoPavel/laravel-unitpay)[![Build Status](https://camo.githubusercontent.com/cf48494a750aec2cb54d8481e8d2754018cf338153949a0998ed32b6750c678b/68747470733a2f2f7472617669732d63692e6f72672f52656b6b6f506176656c2f6c61726176656c2d756e69747061792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/RekkoPavel/laravel-unitpay)[![StyleCI](https://camo.githubusercontent.com/d7668402b62ede7e1ce774af8ce3068b5ed947a5f9f11d562638937bf6c639bf/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136353834313630312f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/165841601)[![CodeFactor](https://camo.githubusercontent.com/dcf6279bb4127702402039ebd66a0862c78e40b4f8567ef86b0575c4bf4fbfd4/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f52656b6b6f506176656c2f6c61726176656c2d756e69747061792f6261646765)](https://www.codefactor.io/repository/github/RekkoPavel/laravel-unitpay)[![Total Downloads](https://camo.githubusercontent.com/87231b7424a33e4afb5ada7560e70025c5079fcd2432a76cbb3ae17edc045c93/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f52656b6b6f506176656c2f6c61726176656c2d756e69747061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/RekkoPavel/laravel-unitpay)[![License](https://camo.githubusercontent.com/d90f83d7dc324744057cf541bdb531279bbfaed99602730a3f4fb4b2ce2d82c9/68747470733a2f2f706f7365722e707567782e6f72672f52656b6b6f506176656c2f6c61726176656c2d756e69747061792f6c6963656e7365)](https://packagist.org/packages/RekkoPavel/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/RekkoPavel/laravel-unitpay/tree/3.x) branch

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

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

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

[](#installation)

Require this package with composer.

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

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

```
RekkoPavel\UnitPay\UnitPayServiceProvider::class,
```

Add the `UnitPay` facade to your facades array:

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

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

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

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

License
-------

[](#license)

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

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 88.2% 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/88a729d74621c79788841ecdb75ad3b63f11a98f2fd46d99b888f8fbb44c2779?d=identicon)[rekkopavel](/maintainers/rekkopavel)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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