laravel-click-merchant maintained by nsilver
Laravel Click Merchant
An unofficial Laravel SDK for the Click Uzbekistan Merchant API.
Requirements
- PHP 8.3+
- Laravel 13
- Click Merchant API credentials
Features
- Invoice creation
- Invoice status checking
- Payment status checking
- Payment lookup by merchant transaction ID
- Payment reversal
- SHA1 Merchant API authentication
- Typed Request and Response DTOs
- API exception handling
- Laravel auto-discovery
Installation
Install via Composer:
composer require nsilver/laravel-click-merchant:^0.1
Laravel will automatically register the package's service provider.
Configuration
Add your Click Merchant credentials to .env:
CLICK_BASE_URL=https://api.click.uz/v2/merchant
CLICK_SERVICE_ID=
CLICK_MERCHANT_USER_ID=
CLICK_SECRET_KEY=
Get the credentials from your Click Merchant account.
Usage
Create an invoice
use NSilver\ClickMerchant\ClickMerchant;
use NSilver\ClickMerchant\DTO\Requests\CreateInvoiceData;
$click = app(ClickMerchant::class);
$invoice = $click->invoices()->create(
new CreateInvoiceData(
amount: 50000,
phone: '998901234567',
merchantTransId: 'ORDER-1001',
)
);
$invoiceId = $invoice->invoiceId;
Check invoice status
$status = $click->invoices()->status($invoiceId);
$invoiceStatus = $status->invoiceStatus;
$description = $status->invoiceStatusNote;
Check payment status
$payment = $click->payments()->status(987654);
$paymentId = $payment->paymentId;
$paymentStatus = $payment->paymentStatus;
Find payment by merchant transaction ID
$lookup = $click->payments()
->statusByTransactionId('ORDER-1001');
$paymentId = $lookup->paymentId;
A successful lookup does not necessarily mean the payment has been completed.
Use payments()->status($paymentId) to retrieve
the payment status.
Reverse a payment
$reversal = $click->payments()->reverse(987654);
Payment reversal changes financial state. Do not automatically retry an uncertain reversal result.
Error handling
use NSilver\ClickMerchant\Exceptions\ClickApiException;
try {
$payment = $click->payments()->status(987654);
} catch (ClickApiException $exception) {
report($exception);
}
The SDK distinguishes Click API errors from network failures and invalid response data.
Development
Install development dependencies:
composer install
Run tests:
composer test
Run static analysis:
composer analyse
Check code style:
composer lint
Run all quality checks:
composer quality
Scope
This package integrates with the Click Merchant API.
Shop API Prepare/Complete webhooks, card tokenization, Click Pass and fiscalization are not included in v0.1.0.