PHPackages                             forksoft/laravel-primepayments - 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. forksoft/laravel-primepayments

ActiveLibrary[Payment Processing](/categories/payments)

forksoft/laravel-primepayments
==============================

PrimePayments payments for Laravel

0125PHP

Since Oct 27Pushed 1y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel payment processor package for PrimePayments gateway
===========================================================

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

Accept payments via PrimePayments ([primepayments.ru](https:/primepayments.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)

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

[](#installation)

Require this package with composer.

```
composer require forksoft/laravel-primepayments
```

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

```
Forksoft\PrimePayments\PrimePaymentsServiceProvider::class,
```

Add the `PrimePayments` facade to your facades array:

```
'PrimePayments' => Forksoft\PrimePayments\Facades\PrimePayments::class,
```

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

```
php artisan vendor:publish --provider="Forksoft\PrimePayments\PrimePaymentsServiceProvider"
```

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

[](#configuration)

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

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

Usage
-----

[](#usage)

1. Generate a payment url or get redirect:

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

$url = PrimePayments::getPayUrl($sum, $order_id, $email, $comment);

$redirect = PrimePayments::redirectToPayUrl($sum, $order_id, $email, $comment);
```

You can add custom fields to your payment:

```
$url = PrimePayments::getPayUrl($sum, $order_id, $email, $comment);

$redirect = PrimePayments::redirectToPayUrl($sum, $order_id, $email, $comment);
```

`$email` and `$phone` can be null.

2. Process the request from PrimePayments:

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

Important
---------

[](#important)

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

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

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

Example
-------

[](#example)

The process scheme:

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

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

```
 Route::get('/primepayments/result', 'PrimePaymentsController@handlePayment');
```

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

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

```
class PrimePaymentsController extends Controller
{
    /**
     * Search the order in your database and return that order
     * to paidOrder, if status of your order is 'order_payed'
     *
     * @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 `order_payed` you can set them like string
            $order['_orderStatus'] = $order['status'];

            // Else your field doesn` has value like 'order_payed', you can change this value
            $order['_orderStatus'] = ('1' == $order['status']) ? 'order_payed' : 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 = 'order_payed';
        $order->save();

        //

        return true;
    }

    /**
     * Start handle process from route
     *
     * @param Request $request
     * @return mixed
     */
    public function handlePayment(Request $request)
    {
        return PrimePayments::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)

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

License
-------

[](#license)

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

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% 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/c3d2ce36874100e105dda5183e9134ff4e8b653abeba2dfda175dd27c5e213d4?d=identicon)[Abricos07](/maintainers/Abricos07)

---

Top Contributors

[![DexiDev](https://avatars.githubusercontent.com/u/43301036?v=4)](https://github.com/DexiDev "DexiDev (4 commits)")[![forksoft](https://avatars.githubusercontent.com/u/3998035?v=4)](https://github.com/forksoft "forksoft (4 commits)")

### Embed Badge

![Health badge](/badges/forksoft-laravel-primepayments/health.svg)

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

###  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)
