PHPackages                             alyakin/liqpay-laravel - 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. alyakin/liqpay-laravel

ActiveLibrary[Payment Processing](/categories/payments)

alyakin/liqpay-laravel
======================

Laravel package for Liqpay integration

0.2.0(10mo ago)0206↓50%MITPHPPHP ^8.1CI failing

Since Apr 22Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/2177866/liqpay-laravel)[ Packagist](https://packagist.org/packages/alyakin/liqpay-laravel)[ Docs](https://github.com/2177866/liqpay-laravel)[ RSS](/packages/alyakin-liqpay-laravel/feed)WikiDiscussions main Synced 1mo ago

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

Laravel package for Liqpay integration (liqpay-laravel)
=======================================================

[](#laravel-package-for-liqpay-integration-liqpay-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/857bd513d7721b4435c90aef1fe5dad7b24414fdeced23fe316b43574ab090f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c79616b696e2f6c69717061792d6c61726176656c2e737667)](https://packagist.org/packages/alyakin/liqpay-laravel)[![Downloads](https://camo.githubusercontent.com/cf01c1810e271efc008f3c3e8f93a923469b9e5aebcede1388d6b9f11128b043/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c79616b696e2f6c69717061792d6c61726176656c2e737667)](https://packagist.org/packages/alyakin/liqpay-laravel)[![Laravel](https://camo.githubusercontent.com/2007f8c62ec889a984a41ecca96a5a6d201d250def43e15131a8c646a87d7215/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532422d6f72616e6765)](https://camo.githubusercontent.com/2007f8c62ec889a984a41ecca96a5a6d201d250def43e15131a8c646a87d7215/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532422d6f72616e6765)[![PHP](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)[![License](https://camo.githubusercontent.com/88e1dabf4d223df0950e0985948e231325fefca9fa7fe9e446cf8b1c5e9d9e47/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e)](https://camo.githubusercontent.com/88e1dabf4d223df0950e0985948e231325fefca9fa7fe9e446cf8b1c5e9d9e47/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e)

[![PHPUnit](https://github.com/2177866/liqpay-laravel/actions/workflows/phpunit.yml/badge.svg)](https://github.com/2177866/liqpay-laravel/actions/workflows/phpunit.yml)[![Laravel Pint](https://github.com/2177866/liqpay-laravel/actions/workflows/pint.yml/badge.svg)](https://github.com/2177866/liqpay-laravel/actions/workflows/pint.yml)[![Larastan](https://github.com/2177866/liqpay-laravel/actions/workflows/larastan.yml/badge.svg)](https://github.com/2177866/liqpay-laravel/actions/workflows/larastan.yml)

Package for integrating Liqpay into Laravel application. It allows generating payment links, signing requests, and handling incoming webhook events from Liqpay.

---

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Generating a payment link](#generating-a-payment-link)
    - [Handling webhook from Liqpay](#handling-webhook-from-liqpay-events)
    - [Subscription support](#-subscription-support)
    - [Importing subscriptions from the archive](#-importing-subscriptions-from-the-archive)
    - [Managing subscriptions manually](#-managing-subscriptions-manually)
- [Localization &amp; Translations](#localization--translations)
- [Testing](#testing)
- [License](#license)

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 9+

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

[](#installation)

Add the package via Composer:

```
composer require alyakin/liqpay-laravel
```

Publishing the configuration:

```
php artisan vendor:publish --tag=liqpay-config
php artisan vendor:publish --tag=liqpay-migrations
```

Check the created configuration and migration files, make changes (add your own fields if needed), and then run

```
php artisan migrate
```

---

**Custom columns support:**If you add custom fields to the `liqpay_subscriptions` table, the package provides an [event mechanism](docs/CUSTOM_FIELDS.md) allowing you to process and update those fields before saving the model.

You can subscribe to the `LiqpaySubscriptionBeforeSave` event to supplement or modify the record dynamically, for example — to populate `user_id` from webhook data or any custom logic.

**See usage example in the [Extending Subscription Model Fields via Event](docs/CUSTOM_FIELDS.md)**

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

[](#configuration)

After publishing, the configuration file `config/liqpay.php` contains:

- `public_key` — public key from Liqpay
- `private_key` — private key from Liqpay
- `result_url` — link for redirecting the user after payment
- `server_url` — link for programmatic notification (webhook)

and parameters for importing

- `archive_from` — default date to start import subscriptions from liqpay API (default: today-90days)
- `archive_to` — default date of end (default today)
- `cache_ttl` — caching time (information for importing), default 1 day (in seconds)

**Rate Limiting Configuration:**

- `rate_limit.enabled` — enable/disable rate limiting for webhook endpoint (default: true)
- `rate_limit.max_attempts` — maximum number of requests per time window (default: 60)
- `rate_limit.decay_minutes` — time window in minutes for rate limiting (default: 1)
- `rate_limit.whitelist.enabled` — enable/disable IP whitelisting (default: false)
- `rate_limit.whitelist.ips` — array of IP addresses to whitelist (bypass rate limiting)

All parameters can be overridden through the `.env` file:

```
LIQPAY_PUBLIC_KEY=your_public_key
LIQPAY_PRIVATE_KEY=your_private_key

# Rate limiting settings
LIQPAY_RATE_LIMIT_ENABLED=true
LIQPAY_RATE_LIMIT_MAX_ATTEMPTS=30
LIQPAY_RATE_LIMIT_DECAY_MINUTES=5

# IP whitelisting (optional)
LIQPAY_RATE_LIMIT_WHITELIST_ENABLED=true
LIQPAY_RATE_LIMIT_WHITELIST_IPS=127.0.0.1,91.213.117.2
LIQPAY_LOG_CHANNEL=liqpay
```

**Logging Configuration:**

- `log_channel` — logging channel registered in `config/logging.php` that receives webhook entries (default: `liqpay`).

Example channel definition in `config/logging.php`:

```
'channels' => [
    // ...
    'liqpay' => [
        'driver' => 'single',
        'path' => storage_path('logs/liqpay.log'),
        'level' => 'info',
    ],
],
```

Because this channel lives in your application config, it will not be recreated automatically during package updates. Keep the channel definition in your repository so webhook logs continue writing to `logs/liqpay.log`.

Usage
-----

[](#usage)

### Generating a payment link

[](#generating-a-payment-link)

```
use Alyakin\LiqpayLaravel\Contracts\LiqpayServiceInterface as Liqpay;
use Alyakin\LiqpayLaravel\DTO\LiqpayRequestDto;

$liqpay = app(Liqpay::class);

$url = $liqpay->getPaymentUrl(LiqpayRequestDto::fromArray([
    'version' => 3,
    'public_key' => config('liqpay.public_key'),
    'action' => 'pay',
    'amount' => 100,
    'currency' => 'UAH',
    'description' => 'Payment for order #'.($a = rand(1000,9999)),
    'language' => 'ua',
    'order_id' => 'ORDER-'.$a,
    'result_url' => config('liqpay.result_url'),
    'server_url' => config('app.url').config('liqpay.server_url'),
]));

return redirect($url);
```

### Handling webhook from Liqpay (events)

[](#handling-webhook-from-liqpay-events)

The package automatically registers the route `/api/liqpay/webhook` (the route from the config) and includes a handler for incoming requests.

**⚠️ Security Note:** The webhook endpoint is protected against DDoS attacks using rate limiting. By default, it allows 60 requests per minute per IP address. You can configure these settings in the configuration file or disable rate limiting entirely if needed.

When the webhook is triggered, the following events are called:

- `LiqpayWebhookReceived` - occurs when ANY webhook is received from Liqpay

After the general event is triggered, events corresponding to the statuses will be called:

- `LiqpayPaymentFailed` - occurs when payment fails
- `LiqpayPaymentSucceeded` - occurs when payment is successful
- `LiqpayPaymentWaiting` - occurs when payment is pending
- `LiqpayReversed` - occurs when payment is canceled
- `LiqpaySubscribed` - occurs when subscribing to payments
- `LiqpayUnsubscribed` - occurs when unsubscribing from payments

To handle these events in your Laravel application, you can register the corresponding event listeners. Pay special attention to [the package's behavior in case of errors in event handlers](docs/EVENTS.md).

Example of registering a listener for the `LiqpayPaymentSucceeded` event:

```
namespace App\Listeners;

use Alyakin\LiqpayLaravel\Events\LiqpayPaymentSucceeded;

class HandleLiqpayPaymentSucceeded
{
    public function handle(LiqpayPaymentSucceeded $event)
    {

        \Log::debug(__method__, $event->dto->toArray());
        // Your code for handling successful payment
    }
}
```

The event has a property `dto`, which is [an object](/src/DTO/LiqpayWebhookDto.php).

You can also enable the built-in event handler `LiqpayWebhookReceived` for logging all incoming webhooks by registering it in `app/Providers/EventServiceProvider.php` in the `boot` method as follows:

```
Event::listen(
    \Alyakin\LiqpayLaravel\Events\LiqpayWebhookReceived::class,
    \Alyakin\LiqpayLaravel\Listeners\LogLiqpayWebhook::class,
);
```

### 📦 Subscription support

[](#-subscription-support)

The package supports automatic subscription registration via webhook (`action: subscribe`) and deactivation (`status: unsubscribed`).

### 📥 Importing subscriptions from the archive

[](#-importing-subscriptions-from-the-archive)

To import and synchronize Liqpay subscriptions in bulk, use the built-in Artisan command:

```
php artisan liqpay:sync-subscriptions [--from=YYYY-MM-DD] [--to=YYYY-MM-DD] [--restart]
```

- By default, the command imports the archive for the past month.
- Supports safe resuming: processing progress is saved in cache and can recover from interruptions.
- The `--restart` flag resets progress and restarts the import from scratch.
- Archive processing is memory efficient: CSV is streamed and never fully loaded into memory.

**Example:**

```
php artisan liqpay:sync-subscriptions --from=2024-01-01 --to=2024-06-30
```

The archive is downloaded directly from the Liqpay API, and large datasets are handled reliably, even with failures or restarts.

---

**Recommended for initial data loading.**

### 🔧 Managing subscriptions manually

[](#-managing-subscriptions-manually)

```
$liqpay->unsubscribe('ORDER-123');
$liqpay->subscribeUpdate('ORDER-124', null, 'Subscribe updated');
```

Localization &amp; Translations
-------------------------------

[](#localization--translations)

All messages support translations out of the box (en/ru/uk). For best practices and details on customizing translations, see [TRANSLATIONS.md](./docs/TRANSLATIONS.md).

Testing
-------

[](#testing)

All tests can be found in the folder with [`tests`](/tests/)

To run the tests, use the command

```
composer test
```

License
-------

[](#license)

This package is distributed under the [MIT License](/LICENSE).

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance65

Regular maintenance activity

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

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

Total

5

Last Release

306d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9eab5787b91f8e98e632f072b3f87a3c5d2f1e4c3a68dbdaaca650e022d0ae61?d=identicon)[2177866](/maintainers/2177866)

---

Top Contributors

[![2177866](https://avatars.githubusercontent.com/u/64738025?v=4)](https://github.com/2177866 "2177866 (35 commits)")

---

Tags

laravellaravel-integrationlaravel-liqpaylaravel-packagelaravel-paymentliqpaypayment-gatewayphpwebhook-receiverlaravelpaymentliqpayalyakin

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/alyakin-liqpay-laravel/health.svg)

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

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

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