PHPackages                             osa-eg/laravel-alqaseh - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. osa-eg/laravel-alqaseh

ActiveLibrary[Payment Processing](/categories/payments)

osa-eg/laravel-alqaseh
======================

Laravel package for Al Qaseh payment gateway integration

1.0.0(1y ago)111MITPHPPHP &gt;=8.0

Since Apr 29Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/osa-eg/laravel-alqaseh)[ Packagist](https://packagist.org/packages/osa-eg/laravel-alqaseh)[ RSS](/packages/osa-eg-laravel-alqaseh/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

 [![Image 2](assets/images/laravel-alqaseh.jpg)](assets/images/laravel-alqaseh.jpg)

Laravel Al Qaseh Payment Gateway
================================

[](#laravel-al-qaseh-payment-gateway)

[![License](https://camo.githubusercontent.com/fcde58a722eda583827081cce2c9f132571da4ad600a3f5d0ca90a3700c9db67/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f73612d65672f6c61726176656c2d616c7161736568)](LICENSE.md)

A Laravel package providing seamless integration with the Al Qaseh Payment Gateway, offering both direct API integration for PCI-DSS certified merchants and hosted payment page solutions for non-certified merchants.

Features
--------

[](#features)

- 💳 Full payment gateway integration for Laravel applications
- 🔐 Supports both PCI-DSS certified and non-certified merchant flows
- 📦 Comprehensive API coverage including:
    - Payment creation &amp; processing
    - Payment status tracking
    - History retrieval &amp; CSV export
    - Payment retry &amp; revocation
    - Detailed payment context inspection
- 🛡️ Built-in validation and error handling
- 🧪 Sandbox mode with test credentials
- 📄 Automatic configuration management
- 🔄 Support for all transaction types (Retail, Authorization, Reversal, CompleteSales)

Documentation
-------------

[](#documentation)

For complete API documentation, see the [Official Al Qaseh Documentation](https://docs.alqaseh.com).

Installation
------------

[](#installation)

```
composer require osa-eg/laravel-alqaseh
```

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --provider="Osama\AlQaseh\AlQasehServiceProvider" --tag="config"
```

Configuration options (`config/alqaseh.php`):

```
'api_key' => env('ALQASEH_API_KEY'),         // Live API key
'merchant_id' => env('ALQASEH_MERCHANT_ID'), // Merchant ID
'base_url' => env('ALQASEH_BASE_URL', 'https://api.alqaseh.com/v1'),
'sandbox' => env('ALQASEH_SANDBOX', true),   // Enable test mode

// Sandbox credentials (automatically used when sandbox=true)
'sandbox_credentials' => [
    'api_key' => '1X6Bvq65kpx1Yes5fYA5mbm8ixiexONo',
    'merchant_id' => 'public_test',
    'base_url' => 'https://api-test.alqaseh.com/v1',
],
```

Add to your `.env`:

```
ALQASEH_API_KEY=your-live-api-key
ALQASEH_MERCHANT_ID=your-merchant-id
ALQASEH_SANDBOX=true
```

Usage
-----

[](#usage)

### Initialization

[](#initialization)

```
use Osama\AlQaseh\Facades\AlQaseh;

// Configuration is automatically loaded from .env
// Sandbox mode is enabled by default
```

### Payment Operations

[](#payment-operations)

#### Create Payment ([API Reference](https://docs.alqaseh.com/api#tag/payment-gateway-service/POST/egw/payments/create))

[](#create-payment-api-reference)

```
try {
    $response = AlQaseh::createPayment(
        amount: 100.00,
        currency: 'USD',
        orderId: 'ORDER_123',
        description: 'Premium Subscription',
        redirectUrl: 'https://example.com/callback',
        transactionType: 'Retail',
        email: 'customer@example.com',
        country: 'US',
        webhookUrl: 'https://example.com/webhooks/payment'
    );

    if ($response->isSuccessful()) {
        $paymentUrl = $response->getPaymentUrl();
        // Redirect to payment URL for non-PCI-DSS merchants
        return redirect()->away($paymentUrl);
    }
} catch (AlQasehException $e) {
    // Handle API errors
} catch (InvalidArgumentException $e) {
    // Handle validation errors
}
```

#### Get Payment History ([API Reference](https://docs.alqaseh.com/api#tag/payment-gateway-service/GET/egw/payments/history))

[](#get-payment-history-api-reference)

```
$history = AlQaseh::getPaymentHistory(
    filters: [
        'from' => now()->subWeek(),
        'to' => now(),
        'payment_status' => 'succeeded'
    ],
    limit: 50,
    orderBy: 'desc'
);

$payments = $history->getData()['payments'];
```

#### Download Payment History ([API Reference](https://docs.alqaseh.com/api#tag/payment-gateway-service/GET/egw/payments/history/download))

[](#download-payment-history-api-reference)

```
$csvData = AlQaseh::downloadPaymentHistory([
    'transaction_type' => 'Retail',
    'from' => '2024-01-01',
    'order_by' => 'asc'
]);

Storage::put('payments.csv', $csvData);
```

#### Get Payment Information ([API Reference](https://docs.alqaseh.com/api#tag/payment-gateway-service/GET/egw/payments/%7Bid%7D))

[](#get-payment-information-api-reference)

```
$paymentInfo = AlQaseh::getPaymentInfo('payment-id');
$status = $paymentInfo->getData()['status'];

// Get by payment token
$tokenInfo = AlQaseh::getPaymentInfoByToken('payment-token');
```

#### Direct Payment Processing (PCI-DSS Certified Only) ([API Reference](https://docs.alqaseh.com/api#tag/payment-gateway-service/POST/egw/payments/process/%7Btoken%7D))

[](#direct-payment-processing-pci-dss-certified-only-api-reference)

```
try {
    $result = AlQaseh::processPayment(
        token: 'payment-token',
        cardNumber: '4111111111111111',
        cvv: '123',
        expiryMonth: '12',
        expiryYear: '2026'
    );

    if ($result->isSuccessful()) {
        $transactionId = $result->getTransactionId();
    }
} catch (AlQasehException $e) {
    // Handle processing errors
}
```

#### Retry Failed Payment ([API Reference](https://docs.alqaseh.com/api#tag/payment-gateway-service/POST/egw/payments/retry))

[](#retry-failed-payment-api-reference)

```
AlQaseh::retryPayment(
    paymentId: 'failed-payment-id',
    details: 'Retry after system error'
);
```

#### Revoke Payment ([API Reference](https://docs.alqaseh.com/api#tag/payment-gateway-service/POST/egw/payments/revoke))

[](#revoke-payment-api-reference)

```
AlQaseh::revokePayment(
    paymentId: 'pending-payment-id',
    details: 'Customer cancellation request'
);
```

Validation
----------

[](#validation)

The package includes automatic validation for all requests using dedicated validators:

- `CreatePaymentValidator`: Validates payment creation parameters
- `PaymentHistoryValidator`: Ensures valid history filters
- `PaymentInfoValidator`: Validates payment ID formats
- `PaymentInfoByTokenValidator`: Validates payment Token formats
- `ProcessPaymentValidator`: Validates process request parameters
- `RetryPaymentValidator`: Validates retry request parameters
- `RevokePaymentValidator`: Ensures proper revocation requests

Example validation error handling:

```
try {
    // API operation
} catch (InvalidArgumentException $e) {
    return response()->json([
        'error' => $e->getMessage()
    ], 400);
}
```

Response Handling
-----------------

[](#response-handling)

The `PaymentResponse` object provides these methods:

```
$response->isSuccessful();    // Check if request succeeded
$response->getPaymentUrl();    // Get hosted payment page URL
$response->getTransactionId(); // Retrieve transaction ID
$response->getErrorMessage();  // Get error description
$response->getErrorCode();     // Get API error code
$response->getData();          // Get full response payload
```

Security
--------

[](#security)

This package supports:

- PCI-DSS compliant integrations for certified merchants
- Secure hosted payment pages for non-certified merchants
- End-to-end encryption
- Sandbox testing environment
- Automatic credential management
- Built-in input validation

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance50

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

378d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/825b6655f6531092c23fc440fcc15222385f7a41b3a2804cd17c3d23e1d760f4?d=identicon)[osa-eg](/maintainers/osa-eg)

---

Top Contributors

[![osa-eg](https://avatars.githubusercontent.com/u/76439995?v=4)](https://github.com/osa-eg "osa-eg (14 commits)")

---

Tags

alqasehalqaseh-paymentlaravellaravel-packagelaravel-payment-gatewaypayment-gateway

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/osa-eg-laravel-alqaseh/health.svg)

```
[![Health](https://phpackages.com/badges/osa-eg-laravel-alqaseh/health.svg)](https://phpackages.com/packages/osa-eg-laravel-alqaseh)
```

###  Alternatives

[sebdesign/laravel-viva-payments

A Laravel package for integrating the Viva Payments gateway

4845.9k](/packages/sebdesign-laravel-viva-payments)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[henryejemuta/laravel-monnify

A laravel package to seamlessly integrate monnify api within your laravel application

132.1k](/packages/henryejemuta-laravel-monnify)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
