Skip to content

qpay-sdk/qpay-laravel

Repository files navigation

QPay Laravel

CI Packagist License: MIT

QPay V2 payment integration for Laravel.

Install

composer require qpay-sdk/laravel
php artisan qpay:install

Configuration

Add to .env:

QPAY_BASE_URL=https://merchant.qpay.mn
QPAY_USERNAME=your_username
QPAY_PASSWORD=your_password
QPAY_INVOICE_CODE=your_invoice_code
QPAY_CALLBACK_URL=https://yoursite.com/qpay/webhook

Usage

use QPay\Laravel\Facades\QPay;
use QPay\Models\CreateSimpleInvoiceRequest;

$invoice = QPay::createSimpleInvoice(new CreateSimpleInvoiceRequest(
    invoiceCode: config('qpay.invoice_code'),
    senderInvoiceNo: 'ORDER-001',
    amount: 10000,
    callbackUrl: config('qpay.callback_url'),
));

// $invoice->invoiceId, $invoice->qrImage, $invoice->urls

Blade Components

<x-qpay-qr-code :qr-image="$invoice->qrImage" />
<x-qpay-payment-button :urls="$invoice->urls" :short-url="$invoice->qPayShortUrl" />

Webhook

Listen for payment events:

use QPay\Laravel\Events\PaymentReceived;

Event::listen(PaymentReceived::class, function ($event) {
    // $event->paymentId
    // $event->result->rows
});

License

MIT

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors