PHP code example of andriichuk / liqpay-php-sdk
1. Go to this page and download the library: Download andriichuk/liqpay-php-sdk library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
andriichuk / liqpay-php-sdk example snippets
use Andriichuk\LiqPay\LiqPay;
$liqpay = new LiqPay($_ENV['LIQPAY_PUBLIC_KEY'], $_ENV['LIQPAY_PRIVATE_KEY']);
$result = $liqpay->refund()
->orderId('order_id_1')
->amount('19.90')
->send();
$status = $result['status'] ?? null;
$result = $liqpay->refund()
->orderId('order_id_1')
->version('3')
->send();
use Andriichuk\LiqPay\Configuration;
$liqpay = new LiqPay($publicKey, $privateKey, configuration: new Configuration(
httpOptions: [
'timeout' => 15.0,
'connect_timeout' => 5.0,
'proxy' => 'http://proxy.example.com:8080',
'verify' => '/path/to/ca-bundle.pem',
],
userAgent: 'my-shop/1.0',
));
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\HttpFactory;
$factory = new HttpFactory();
$liqpay = new LiqPay(
$publicKey,
$privateKey,
httpClient: new Client(['timeout' => 10, 'connect_timeout' => 3]),
requestFactory: $factory,
streamFactory: $factory,
);
$result = $liqpay->subscriptions()->create()
->orderId('membership-123')
->amount('29.00')
->currency('UAH')
->description('Monthly membership')
->card($cardNumber)
->cardCvv($cvv)
->cardExpMonth('12')
->cardExpYear('29')
->ip($customerIp)
->phone($customerPhone)
->subscribeDateStart('2026-11-01 10:00:00')
->subscribePeriodicity('month')
->serverUrl('https://shop.example.com/liqpay/callback')
->send();
$liqpay->subscriptions()->update()
->orderId('membership-123')
->amount('35.00')->currency('UAH')->description('Updated membership')
->send();
$liqpay->subscriptions()->cancel()->orderId('membership-123')->send();
$liqpay->invoices()->create()
->orderId('invoice-123')->amount('100.00')->currency('UAH')
->description('Invoice #123')->email($email)->phone($phone)
->send();
$liqpay->invoices()->cancel()->orderId('invoice-123')->send();
$units = $liqpay->invoices()->units()->language('en')->send();
$checkout = $liqpay->checkout()
->orderId('order-123')->amount('125.00')->currency('UAH')
->description('Order #123')->language('en')
->resultUrl('https://shop.example.com/thank-you')
->serverUrl('https://shop.example.com/liqpay/callback');
$payload = $checkout->payload(); // ['url' => ..., 'data' => ..., 'signature' => ...]
echo $checkout->form('Pay now'); // Escaped HTML form, no remote script injection.
$widgetPayload = $liqpay->widget()
->orderId('widget-123')->amount('50.00')->currency('UAH')
->description('Widget purchase')->payload();
$checkout = $checkout->splitRules([
['public_key' => 'recipient-key', 'amount' => '25.00', 'commission_payer' => 'sender'],
])->rroInfo([
'items' => [['id' => 1, 'amount' => 1, 'price' => 125, 'cost' => 125]],
'delivery_emails' => [$email],
]);
$status = $liqpay->status()->orderId('order-123')->send();
$liqpay->capture()->orderId('order-123')->amount('100.00')->send();
$liqpay->confirmations()->otp()->confirmToken($token)->otp($otp)->send();
$liqpay->confirmations()->cvv()->confirmToken($token)->cardCvv($cvv)->send();
$liqpay->confirmations()->threeDs()->confirmToken($token)->send();
$liqpay->tokens()->create()->isDebit(true)->isCredit(false)
->card($cardNumber)->cardCvv($cvv)->cardExpMonth('12')->cardExpYear('29')->send();
$liqpay->tokens()->update()->cardToken($cardToken)->cardTokenAction('SUSPEND')->send();
$reports = $liqpay->information()->reports()
->dateFrom('1759276800000')->dateTo('1761955199999')->send();
$csv = $liqpay->information()->reports()->respFormat('csv')->send();
$rates = $liqpay->publicApi()->exchangeRates()->coursid(11)->send();
$archive = $liqpay->publicApi()->exchangeArchive()->date('01.10.2026')->send();
$payload = $liqpay->callback()->verify($_POST['data'], $_POST['signature']);
// Signature verified, merchant key matched; $payload is an associative array.
$response = $liqpay->refund()->orderId('order-123')->amount('10.00')->send();
// PHPStan knows the refund fields and their original wire types.
$paymentId = $response['payment_id'] ?? null; // int|numeric-string|null
$waiting = $response['wait_amount'] ?? null; // bool|'true'|'false'|null
$template = $liqpay->refund()->amount('10.00');
$first = $template->orderId('first');
$second = $template->orderId('second');
$request = $first->withParameter('new_api_option', ['enabled' => true]);
$parameters = $request->toArray(); // Inspect without sending; credentials are added at signing time.
bash
composer config repositories.liqpay vcs https://github.com/andriichuk/liqpay-php-sdk
composer bash
git clone https://github.com/andriichuk/liqpay-php-sdk.git
cd liqpay-php-sdk
composer install
composer check