PHPackages                             lahza/payment-gateway - 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. lahza/payment-gateway

ActiveLibrary[Payment Processing](/categories/payments)

lahza/payment-gateway
=====================

A robust Laravel payment gateway package developed by Palestinian developer Khalil Khasseb

1.1.0(1y ago)010MITPHPPHP ^8.0

Since Jan 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/khalilKhasseb/lahza-payment-gateway)[ Packagist](https://packagist.org/packages/lahza/payment-gateway)[ RSS](/packages/lahza-payment-gateway/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (4)Used By (0)

Lahza Payment Gateway
=====================

[](#lahza-payment-gateway)

[![Latest Version on Packagist](https://camo.githubusercontent.com/84b38bba97c02a6e3e420af19ba5ff2b6388f5c2f5ee497e3f9c4258db849724/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61687a612f7061796d656e742d676174657761792e737667)](https://packagist.org/packages/lahza/payment-gateway)[![GitHub Tests Action Status](https://github.com/yourusername/lahza-payment-gateway/actions/workflows/tests.yml/badge.svg)](https://github.com/yourusername/lahza-payment-gateway/actions)[![MIT License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](https://opensource.org/licenses/MIT)

A Laravel package for seamless integration with the Lahza Payment Gateway. Process payments, handle webhooks, and manage transactions with ease.

Author
------

[](#author)

**Khalil Khasseb**
📍 Palestine - Aroura
✉️
💻 [GitHub Profile](https://github.com/khalilkhasseb)

Features (Updated)
------------------

[](#features-updated)

- 💰 Automatic currency conversion (USD/ILS/JOD)
- 🔒 Conditional webhook handling
- 🧩 Data Transfer Objects (DTOs) for API responses
- 🚦 Improved validation error messages

Configuration (Updated)
-----------------------

[](#configuration-updated)

Add to your `.env`:

```
LAHZA_INLINE_CALLBACK=false
LAHZA_CALLBACK_URL=
LAHZA_DEFAULT_CURRENCY=USD

## Features

- 💳 Create payment intents
- 🔄 Handle payment confirmations
- ↩️ Process refunds
- 🕸️ Webhook verification
- 🛡️ Robust error handling
- ⚙️ Configurable settings
- 🧪 Fake mode for testing

## Installation

Install via Composer:

```bash
composer require lahza/payment-gateway
```

Publish config file:

```
php artisan vendor:publish --provider="Lahza\PaymentGateway\LahzaServiceProvider" --tag="lahza-config"
```

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

[](#configuration)

Add to your `.env` file:

```
LAHZA_API_KEY=your_api_key
LAHZA_BASE_URL=https://api.lahza.io/v1/
LAHZA_WEBHOOK_SECRET=your_webhook_secret
LAHZA_TIMEOUT=15
LAHZA_RETRIES=3
LAHZA_CURRENCIES=USD,EUR,GBP
```

### Config Options (`config/lahza.php`)

[](#config-options-configlahzaphp)

KeyTypeDescriptionapi\_keystringYour Lahza API keybase\_urlstringAPI base URLtimeoutintRequest timeout in secondsretriesintNumber of request retriesretry\_delayintDelay between retries in millisecondswebhook.secretstringWebhook verification secretwebhook.middlewarearrayMiddleware for webhook routescurrenciesarraySupported currenciesUsage
-----

[](#usage)

### Create Payment Intent

[](#create-payment-intent)

```
use Lahza\Facades\Lahza;

try {
    use Lahza\Facades\Lahza;

$transaction = Lahza::initializeTransaction([
    'email' => 'customer@example.com',
    'amount' => 100.50, // Automatically converted to cents
    'currency' => 'USD'
]);

return redirect()->away($transaction->authorizationUrl);

} catch (\Lahza\PaymentGateway\Exceptions\PaymentException $e) {
    // Handle error
}
```

### Confirm Payment

[](#confirm-payment)

```
$verified = Lahza::verifyTransaction('TXN_12345');
echo $verified->amount; // Returns decimal value
```

### Handle Webhooks

[](#handle-webhooks)

```
// Get supported currencies
$currencies = config('lahza.currencies');

// Get default currency
$default = Lahza::getDefaultCurrency();
```

### Handle Webhooks

[](#handle-webhooks-1)

Add to `routes/web.php`:

```
Route::post('/lahza/webhook', function (Request $request) {
    // Handle webhook
})->middleware('lahza.webhook');
```

Webhook config

```
'webhook' => [
    'enabled' => true,
    'secret' => env('LAHZA_WEBHOOK_SECRET'),
    'middleware' => ['api']
]
```

### Error Handling

[](#error-handling)

```
try {
    $transaction = Lahza::initializeTransaction(...);
} catch (\Lahza\PaymentGateway\Exceptions\PaymentValidationException $e) {
    foreach ($e->getErrors() as $field => $messages) {
        // Handle validation errors
    }
} catch (\Lahza\PaymentGateway\Exceptions\PaymentException $e) {
    logger()->error('Payment failed: ' . $e->getMessage(), [
        'context' => $e->getContext()
    ]);
}
```

Sample error response:

```
{
    "error": "validation_error",
    "message": "Validation failed for 2 fields",
    "error_code": 422,
    "documentation": "https://api-docs.lahza.io/errors/422",
    "errors": {
        "amount": ["Must be at least 0.5"],
        "currency": ["Invalid currency"]
    }
}
```

Testing
-------

[](#testing)

Enable fake mode:

```
Lahza::fake();

// Mock specific endpoints
Lahza::fake([
    '/transaction/initialize' => [
        'status' => true,
        'data' => [
            'authorization_url' => 'https://checkout.lahza.io/fake',
            'reference' => 'TEST_123'
        ]
    ]
]);****
```

TODO: Future Enhancements
-------------------------

[](#todo-future-enhancements)

- Add support for recurring payments
- Implement payment method management
- Add currency conversion utilities
- Support 3D Secure payments
- Create admin dashboard integration
- Add more test coverage
- Implement rate limiting
- Add payment dispute handling
- Support multiple API versions
- Add PCI-compliant card storage
- Develop mobile SDK integration
- Create webhook event factory
- Add payment analytics
- Support marketplace split payments
- Implement payment retry logic

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

[](#documentation)

Full API documentation available at [Lahza API Docs](https://api-docs.lahza.io)

Contributing
------------

[](#contributing)

1. Fork the project
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit changes (`git commit -m 'Add some amazing feature'`)
4. Push to branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

Security
--------

[](#security)

If you discover any security issues, please email:
🔒
instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). See [LICENSE](LICENSE) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance42

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

Every ~1 days

Total

3

Last Release

473d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab2930717ddb19f163749ffc91ca50a1770f3d8fd989de2aed0ea8463f6cd44e?d=identicon)[khalilKhasseb](/maintainers/khalilKhasseb)

---

Top Contributors

[![khalilKhasseb](https://avatars.githubusercontent.com/u/194904754?v=4)](https://github.com/khalilKhasseb "khalilKhasseb (4 commits)")

### Embed Badge

![Health badge](/badges/lahza-payment-gateway/health.svg)

```
[![Health](https://phpackages.com/badges/lahza-payment-gateway/health.svg)](https://phpackages.com/packages/lahza-payment-gateway)
```

###  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)
