</>
maximorum.com

How to integrate LiqPay payments into a Laravel application

D

One API for every Ukrainian payment method

Ukrainian businesses processing online payments need a gateway their customers trust. LiqPay — PrivatBank's payment platform — handles credit cards, Apple Pay, Google Pay, and installment plans in a single API. Integrating it into a Laravel application takes roughly a day's engineering work and removes a conversion blocker for every checkout page.

Laravel code editor open with LiqPay payment integration — MaxiMoruM

What LiqPay gives your business

A single LiqPay integration covers:

  • Card payments (Visa, Mastercard) in UAH, USD, and EUR
  • Apple Pay and Google Pay for mobile buyers
  • Monobank Installments and PrivatBank credit splitting
  • Recurring charges for subscription products
  • Instant webhook callbacks for order status updates

For an e-commerce operator, that means one codebase change covers the full spectrum of Ukrainian buyers — without stitching together four separate payment gateways.

How the integration works in Laravel

LiqPay communicates over a clean HTTP API. You encode a payload as Base64 JSON, sign it with your private key using SHA-1, and POST both values to LiqPay's checkout endpoint. The flow maps naturally to a Laravel service class:

// config/services.php
'liqpay' => [
    'public_key'  => env('LIQPAY_PUBLIC_KEY'),
    'private_key' => env('LIQPAY_PRIVATE_KEY'),
],

// app/Services/LiqPayService.php
class LiqPayService
{
    public function createCheckoutForm(array $order): string
    {
        $liqpay = new LiqPay(
            config('services.liqpay.public_key'),
            config('services.liqpay.private_key')
        );

        return $liqpay->cnb_form([
            'action'      => 'pay',
            'amount'      => $order['amount'],
            'currency'    => 'UAH',
            'description' => $order['description'],
            'order_id'    => $order['id'],
            'version'     => '3',
            'result_url'  => route('checkout.success'),
            'server_url'  => route('liqpay.callback'),
        ]);
    }
}

Secure callback handling

LiqPay sends a signed POST to your server_url after every payment attempt. Verify the signature before touching any order record:

public function handleCallback(Request $request): Response
{
    $data      = $request->input('data');
    $signature = $request->input('signature');
    $key       = config('services.liqpay.private_key');

    $expected = base64_encode(sha1($key . $data . $key, true));

    abort_if($signature !== $expected, 403, 'Invalid LiqPay signature');

    $payload = json_decode(base64_decode($data), true);

    if ($payload['status'] === 'success') {
        Order::find($payload['order_id'])->markAsPaid();
    }

    return response('OK');
}

Route this callback to a queued ProcessLiqPayCallback job rather than handling it synchronously. This keeps your checkout flow resilient under load spikes and lets you retry on transient database failures.

Go-live checklist

  • Store LIQPAY_PUBLIC_KEY and LIQPAY_PRIVATE_KEY in .env — never in version control
  • Add your server_url to LiqPay's sandbox whitelist during testing
  • Log every inbound callback payload for debugging and audit
  • Test all scenarios: success, failure, pending, and chargeback
  • Enable two-factor confirmation in your LiqPay merchant account

Business result

A properly integrated LiqPay checkout reduces payment friction for Ukrainian buyers, supports installment plans that increase average order value, and gives your operations team a single dashboard for refunds and disputes. Most MaxiMoruM clients see checkout abandonment drop within the first billing cycle after switching from a manual bank-transfer flow.

Ready to add LiqPay — or any Ukrainian payment gateway — to your Laravel application? Contact MaxiMoruM and we'll scope the integration in one call.