PHP code example of quickpayge / laravel

1. Go to this page and download the library: Download quickpayge/laravel 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/ */

    

quickpayge / laravel example snippets


use Quickpay\Laravel\Facades\Quickpay;

$payment = Quickpay::payments->create([
    'amount'            => 99.99,
    'currency'          => 'GEL',
    'description'       => 'Order #1234',
    'merchant_order_id' => 'order-1234',
    'idempotency_key'   => 'order-1234-attempt-1',
    'customer' => [
        'name'  => 'John Doe',
        'email' => '[email protected]',
        'phone' => '+995599123456',
    ],
]);

return redirect($payment->paymentUrl);

// routes/web.php
Route::post('/webhook/quickpay', function (Request $request) {
    $event = $request->attributes->get('quickpay_event'); // \Quickpay\Webhook\WebhookEvent

    if ($event->type === 'payment.paid') {
        // mark order as paid
    }

    return response()->json(['ok' => true]);
})->middleware('quickpay.webhook');

// routes/web.php
use Quickpay\Laravel\Http\Controllers\WebhookController;

Route::post('/webhook/quickpay', WebhookController::class)
    ->middleware('quickpay.webhook');

// app/Providers/EventServiceProvider.php
protected $listen = [
    \Quickpay\Laravel\Events\PaymentPaid::class     => [App\Listeners\HandlePaymentPaid::class],
    \Quickpay\Laravel\Events\PaymentFailed::class   => [App\Listeners\HandlePaymentFailed::class],
    \Quickpay\Laravel\Events\PaymentExpired::class  => [App\Listeners\HandlePaymentExpired::class],
    \Quickpay\Laravel\Events\PaymentRefunded::class => [App\Listeners\HandlePaymentRefunded::class],
    \Quickpay\Laravel\Events\LeadSubmitted::class   => [App\Listeners\HandleLeadSubmitted::class],
];

// app/Listeners/HandlePaymentPaid.php
use Quickpay\Laravel\Events\PaymentPaid;

class HandlePaymentPaid
{
    public function handle(PaymentPaid $event): void
    {
        $payment = $event->payment; // \Quickpay\DTO\Payment
        // Update your order, send confirmation email, etc.
    }
}

use Quickpay\Exceptions\AuthException;
use Quickpay\Exceptions\ValidationException;
use Quickpay\Exceptions\RateLimitException;
use Quickpay\Exceptions\NotFoundException;
use Quickpay\Exceptions\QuickpayException;

try {
    $payment = Quickpay::payments->get('some-uuid');
} catch (AuthException $e) {
    // 401/403
} catch (ValidationException $e) {
    // 422 — field errors in $e->errors
} catch (RateLimitException $e) {
    // 429 — retry after $e->retryAfter() seconds
} catch (NotFoundException $e) {
    // 404
} catch (QuickpayException $e) {
    // catch-all
}
bash
php artisan vendor:publish --tag=quickpay-config