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

ActiveLibrary[Payment Processing](/categories/payments)

liqpay/liqpay
=============

SDK for Liqpay

v1.4(1y ago)111678.8k—4.4%127[1 PRs](https://github.com/liqpay/sdk-php/pulls)8OSL 3.0PHPPHP &gt;=7.0

Since Sep 21Pushed 1y ago20 watchersCompare

[ Source](https://github.com/liqpay/sdk-php)[ Packagist](https://packagist.org/packages/liqpay/liqpay)[ Docs](https://github.com/liqpay/sdk-php)[ RSS](/packages/liqpay-liqpay/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (7)Used By (8)

LiqPay Payment Module
=====================

[](#liqpay-payment-module)

> **LiqPay PHP SDK** for seamless integration with [LiqPay](https://www.liqpay.ua) payment gateway.

---

Documentation
-------------

[](#documentation)

For full API reference and details, see the LiqPay API documentation:
[LiqPay API Docs](https://www.liqpay.ua/documentation/en)

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

[](#table-of-contents)

1. [Installation](#installation)
2. [Quick Start](#quick-start)
3. [Usage](#usage)
4. [Public Methods](#public-methods)
    - [Methods Summary](#methods-summary)
    - [`api`](#api)
    - [`get_response_code`](#get_response_code)
    - [`cnb_form`](#cnb_form)
    - [`cnb_form_raw`](#cnb_form_raw)
    - [`cnb_signature`](#cnb_signature)
    - [`decode_params`](#decode_params)
    - [`str_to_sign`](#str_to_sign)

---

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

[](#installation)

Install via Composer:

```
composer require liqpay/liqpay
```

Or include manually:

```
require_once 'path/to/LiqPay.php';
```

---

Quick Start
-----------

[](#quick-start)

```
use LiqPay;

$liqpay = new LiqPay('your_public_key', 'your_private_key');

// Check payment status
$response = $liqpay->api('payment/status', [
    'version'  => 3,
    'action'   => 'status',
    'order_id' => 'order123',
]);

// Generate checkout form
echo $liqpay->cnb_form([
    'version'     => 3,
    'action'      => 'pay',
    'amount'      => 100.50,
    'currency'    => 'USD',
    'description' => 'Order #123 Payment',
    'language'    => 'en',
]);
```

---

Usage
-----

[](#usage)

---

Public Methods
--------------

[](#public-methods)

### Methods Summary

[](#methods-summary)

MethodSignatureDescription`api``api(string $path, array $params = [], int $timeout = 5): object|array`Call LiqPay API and return parsed response.`get_response_code``get_response_code(): int|null`Last HTTP status code from API.`cnb_form``cnb_form(array $params): string`Render HTML checkout form.`cnb_form_raw``cnb_form_raw(array $params): array`Raw URL, data, and signature.`cnb_signature``cnb_signature(array $params): string`Compute data signature for checkout.`decode_params``decode_params(string $data): array`Decode Base64‑encoded payload.`str_to_sign``str_to_sign(string $str): string`Generate Base64‑SHA1 signature.---

### `__construct`

[](#__construct)

Initialize the LiqPay client with your credentials.

```
public function __construct(
    string $public_key,
    string $private_key,
    string|null $api_url = null
)
```

- **Parameters:**
    - `$public_key` *(string)* — Your LiqPay public key.
    - `$private_key` *(string)* — Your LiqPay private key.
    - `$api_url` *(string|null)* — Override default API endpoint.
- **Exceptions:**
    - `InvalidArgumentException` if keys are empty.

---

### `api`

[](#api)

Send a request to a LiqPay API endpoint and get a parsed response.

```
public function api(
    string $path,
    array $params = [],
    int $timeout = 5
): object\|array
```

- **Parameters:**
    - `$path` *(string)* — Endpoint path (e.g., `'payment/status'`).
    - `$params` *(array)* — Must include `version` and `action` (e.g., `'pay'`).
    - `$timeout` *(int)* — Timeout in seconds (connect + exec).
- **Returns:**
    - JSON-decoded object on success.
    - `['error' => '...']` on failure.
- **Exceptions:**
    - `InvalidArgumentException` if required params missing.

---

### `get_response_code`

[](#get_response_code)

Retrieve HTTP status code from the last `api()` call.

```
public function get_response_code(): int\|null
```

- **Returns:**
    - HTTP status code (e.g., `200`) or `null`.

---

### `cnb_form`

[](#cnb_form)

Render a fully functional HTML checkout form with LiqPay JavaScript SDK.

```
public function cnb_form(array $params): string
```

- **Parameters:**
    - `version`, `action`, `amount`, `currency`, `description` *(required)*
    - `language` *(optional)* — `'uk'`, `'ru'`, or `'en'`.
- **Returns:**
    - HTML `` string with embedded button.
- **Example:**

```
echo $liqpay->cnb_form([
  'version'     => 3,
  'action'      => 'paydonate',
  'amount'      => 5,
  'currency'    => 'UAH',
  'description' => 'Support project',
  'language'    => 'uk',
]);
```

---

### `cnb_form_raw`

[](#cnb_form_raw)

Get raw payload data for custom form implementations.

```
public function cnb_form_raw(array $params): array
```

- **Returns:**```
    [
      'url'       => 'https://www.liqpay.ua/api/3/checkout',
      'data'      => '',
      'signature' => '',
    ]
    ```

---

### `cnb_signature`

[](#cnb_signature)

Compute the signature for given parameters (used in custom integrations).

```
public function cnb_signature(array $params): string
```

---

### `decode_params`

[](#decode_params)

Decode Base64‑encoded payment data back to an array.

```
public function decode_params(string $data): array
```

---

### `str_to_sign`

[](#str_to_sign)

Generate a Base64‑SHA1 signature for any string.

```
public function str_to_sign(string $str): string
```

---

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance47

Moderate activity, may be stable

Popularity56

Moderate usage in the ecosystem

Community38

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

5

Last Release

391d ago

PHP version history (3 changes)v1.2.2PHP &gt;=5.3.0

v1.3PHP &gt;=5.6.0

v1.4PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/14cd28ee91c8334d010fb2b64ffcad8385c20410381173f0231a86c941a891f1?d=identicon)[liqpay1](/maintainers/liqpay1)

---

Top Contributors

[![pb-web-develop](https://avatars.githubusercontent.com/u/6715726?v=4)](https://github.com/pb-web-develop "pb-web-develop (20 commits)")[![OleksiiKliuiev](https://avatars.githubusercontent.com/u/139246609?v=4)](https://github.com/OleksiiKliuiev "OleksiiKliuiev (19 commits)")[![viplifes](https://avatars.githubusercontent.com/u/286489?v=4)](https://github.com/viplifes "viplifes (16 commits)")[![kagatan](https://avatars.githubusercontent.com/u/27299810?v=4)](https://github.com/kagatan "kagatan (3 commits)")[![ftw-soft](https://avatars.githubusercontent.com/u/3994510?v=4)](https://github.com/ftw-soft "ftw-soft (2 commits)")[![denisatemash](https://avatars.githubusercontent.com/u/16500279?v=4)](https://github.com/denisatemash "denisatemash (1 commits)")[![Dmitry-Y-Kapustin](https://avatars.githubusercontent.com/u/25437643?v=4)](https://github.com/Dmitry-Y-Kapustin "Dmitry-Y-Kapustin (1 commits)")[![andrewdidovik](https://avatars.githubusercontent.com/u/5871336?v=4)](https://github.com/andrewdidovik "andrewdidovik (1 commits)")[![miserenkov](https://avatars.githubusercontent.com/u/12072466?v=4)](https://github.com/miserenkov "miserenkov (1 commits)")[![oliinykdm](https://avatars.githubusercontent.com/u/5325428?v=4)](https://github.com/oliinykdm "oliinykdm (1 commits)")[![r-kovalenko](https://avatars.githubusercontent.com/u/2025625?v=4)](https://github.com/r-kovalenko "r-kovalenko (1 commits)")[![Gregoire-M](https://avatars.githubusercontent.com/u/475728?v=4)](https://github.com/Gregoire-M "Gregoire-M (1 commits)")[![andreybolonin](https://avatars.githubusercontent.com/u/2576509?v=4)](https://github.com/andreybolonin "andreybolonin (1 commits)")[![AndriyVoloshin](https://avatars.githubusercontent.com/u/4062369?v=4)](https://github.com/AndriyVoloshin "AndriyVoloshin (1 commits)")[![AntonShevel](https://avatars.githubusercontent.com/u/5391187?v=4)](https://github.com/AntonShevel "AntonShevel (1 commits)")[![bocharsky-bw](https://avatars.githubusercontent.com/u/3317635?v=4)](https://github.com/bocharsky-bw "bocharsky-bw (1 commits)")

---

Tags

sdkpaymentpaycheckoutliqpay

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

329224.5k7](/packages/lokielse-omnipay-wechatpay)[pixidos/gpwebpay-core

GPWepPay core php library for http api GPWebPay service

11155.2k1](/packages/pixidos-gpwebpay-core)[enupal/stripe

Allows customers sign up for recurring and one-time payments with Stripe, perfect for orders, donations, subscriptions, and events. Create simple payment forms in seconds easily without coding. For Craft CMS 3.x

3416.5k1](/packages/enupal-stripe)

PHPackages © 2026

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