Skip to content

Latest commit

 

History

History
72 lines (57 loc) · 1.43 KB

README.md

File metadata and controls

72 lines (57 loc) · 1.43 KB

Installation

Install library: composer require litvinchuk/laravel-liqpay

Register Tool in NovaServiceProvider

App\Providers\NovaServiceProvider.php

public function tools()
{
    return [
        new \Litvinchuk\LaravelLiqpay\LaravelLiqpay([
            'registerPublicRoutes' => true,
        ]),
    ];
}

Configuration

Add secret and public keys to .env

LIQPAY_PUBLIC_KEY=public
LIQPAY_PRIVATE_KEY=secret

Create payment

use Litvinchuk\LaravelLiqpay\LiqpayPayment;

$payment = LiqpayPayment::createPayment(10, 'UAH', 'Test payment description');

Pay by link

$payment->getPaymentLink()

Inline pay

render

$payment->renderInline()

manual

<div id="liqpay_checkout"></div>

<script>
    window.LiqPayCheckoutCallback = function() {
        LiqPayCheckout.init({
            data: "{{ $payment->getEncodedParams() }}",
            signature: "{{ $payment->getSignature() }}",
            embedTo: "#liqpay_checkout",
            language: "{{ $payment->language }}",
            mode: "embed" // embed || popup
        }).on("liqpay.callback", function(data){
             console.log(data.status);
             console.log(data);
         }).on("liqpay.ready", function(data){
             // ready
         }).on("liqpay.close", function(data){
             // close
         });
    };
</script>

<script src="//static.liqpay.ua/libjs/checkout.js" async></script>