Download the PHP package alyakin/liqpay-laravel without Composer
On this page you can find all versions of the php package alyakin/liqpay-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package liqpay-laravel
Laravel package for Liqpay integration (liqpay-laravel)
Package for integrating Liqpay into Laravel application. It allows generating payment links, signing requests, and handling incoming webhook events from Liqpay.
Table of Contents
- Requirements
- Installation
- Configuration
- Usage
- Generating a payment link
- Handling webhook from Liqpay
- Subscription support
- Importing subscriptions from the archive
- Managing subscriptions manually
- Localization & Translations
- Testing
- License
Requirements
- PHP 8.1+
- Laravel 9+
Installation
Add the package via Composer:
Publishing the configuration:
Check the created configuration and migration files, make changes (add your own fields if needed), and then run
Custom columns support:
If you add custom fields to the liqpay_subscriptions
table,
the package provides an event mechanism 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
Configuration
After publishing, the configuration file config/liqpay.php
contains:
public_key
— public key from Liqpayprivate_key
— private key from Liqpayresult_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)
All parameters can be overridden through the .env
file:
Usage
Generating a payment link
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.
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 failsLiqpayPaymentSucceeded
- occurs when payment is successfulLiqpayPaymentWaiting
- occurs when payment is pendingLiqpayReversed
- occurs when payment is canceledLiqpaySubscribed
- occurs when subscribing to paymentsLiqpayUnsubscribed
- 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.
Example of registering a listener for the LiqpayPaymentSucceeded
event:
The event has a property dto
, which is an object.
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:
📦 Subscription support
The package supports automatic subscription registration via webhook (action: subscribe
) and deactivation (status: unsubscribed
).
📥 Importing subscriptions from the archive
To import and synchronize Liqpay subscriptions in bulk, use the built-in Artisan command:
- 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:
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
Localization & Translations
All messages support translations out of the box (en/ru/uk). For best practices and details on customizing translations, see TRANSLATIONS.md.
Testing
All tests can be found in the folder with tests
To run the tests, use the command
License
This package is distributed under the MIT License.