PHPackages                             hamraa/lumen-payment - 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. hamraa/lumen-payment

ActiveLibrary[Payment Processing](/categories/payments)

hamraa/lumen-payment
====================

A Lumen package for connecting to payment gateways

3.3.4(6y ago)430MITPHP

Since Jul 11Pushed 6y agoCompare

[ Source](https://github.com/hamraa/lumen-payment)[ Packagist](https://packagist.org/packages/hamraa/lumen-payment)[ Docs](https://github.com/hamraa/lumen-payment)[ RSS](/packages/hamraa-lumen-payment/feed)WikiDiscussions master Synced today

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

lumen-payment
=============

[](#lumen-payment)

A Lumen package for connecting to payment gateways.

By this package we are able to connect to all Iranian bank with one unique API.

Please inform us once you've encountered [bug](https://github.com/hamraa/lumen-payment/issues) or [issue](https://github.com/hamraa/lumen-payment/issues).

Available Banks:

1. MELLAT
2. SADAD (MELLI)
3. SAMAN
4. PARSIAN
5. PASARGAD
6. ZARINPAL
7. PAYPAL (**New**)
8. ASAN PARDAKHT (**New**)
9. PAY.IR (**New**) (to use : new \\Payir())

---

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

[](#installation)

First, install the package via Composer:

```
composer require hamraa/lumen-payment
```

Copy the required files:

```
mkdir -p config
cp vendor/hamraa/lumen-payment/config/payment.php config/payment.php
cp vendor/hamraa/lumen-payment/database/migrations/create_payment_transactions_table.php.stub database/migrations/2016_01_01_000000_create_payment_transactions_table.php
cp vendor/hamraa/lumen-payment/database/migrations/create_payment_transactions_status_logs_table.php.stub database/migrations/2016_01_01_000000_create_payment_transactions_status_logs_table.php
cp vendor/hamraa/lumen-payment/resources/views resources/views
```

Then, in `bootstrap/app.php` :

- register the alias:

```
$app->withFacades(true, [
    'Hamraa\Payment\Gateway' => 'Gateway',
]);
```

- register the config file:

```
$app->configure('payment');
```

- register the service provider:

```
$app->register(\Hamraa\Payment\PaymentServiceProvider::class);
```

Now, run your migrations:

```
php artisan migrate
```

Done!

Usage
-----

[](#usage)

You can make connection to bank in several ways (Facade , Service container):

```
try {

   $gateway = \Gateway::make(new \Mellat());

   // $gateway->setCallback(url('/path/to/callback/route')); You can also change the callback
   $gateway
        ->price(1000)
        // setShipmentPrice(10) // optional - just for paypal
        // setProductName("My Product") // optional - just for paypal
        ->ready();

   $refId =  $gateway->refId(); // شماره ارجاع بانک
   $transID = $gateway->transactionId(); // شماره تراکنش

  // در اینجا
  //  شماره تراکنش  بانک را با توجه به نوع ساختار دیتابیس تان
  //  در جداول مورد نیاز و بسته به نیاز سیستم تان
  // ذخیره کنید .

   return $gateway->redirect();

} catch (\Exception $e) {
    // نمایش خطای تراکنش
    echo $e->getMessage();
}
```

You can call the gateway by these ways :

1. Gateway::make(new Mellat());
2. Gateway::mellat()
3. app('gateway')-&gt;make(new Mellat());
4. app('gateway')-&gt;mellat();

Instead of MELLAT you can enter other banks Name as we introduced above .

In `price` method you should enter the price in IRR (RIAL)

and in your callback :

```
try {

   $gateway = \Gateway::verify();
   $trackingCode = $gateway->trackingCode();
   $refId = $gateway->refId();
   $cardNumber = $gateway->cardNumber();

    // تراکنش با موفقیت سمت بانک تایید گردید
    // در این مرحله عملیات خرید کاربر را تکمیل میکنیم

} catch (\Hamraa\Payment\Exceptions\RetryException $e) {

    // تراکنش قبلا سمت بانک تاییده شده است و
    // کاربر احتمالا صفحه را مجددا رفرش کرده است
    // لذا تنها فاکتور خرید قبل را مجدد به کاربر نمایش میدهیم

    echo $e->getMessage() . "";

} catch (\Exception $e) {

    // نمایش خطای بانک
    echo $e->getMessage();
}
```

Credits
-------

[](#credits)

This package is based on [larabook/gateway](https://github.com/larabook/gateway) (payment package for laravel) with some major change to compatible with Lumen framework and some code improvments.

Thanks
------

[](#thanks)

Special thanks to [larabook team](http://larabook.ir).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~66 days

Total

2

Last Release

2429d ago

Major Versions

1.0.0 → 3.3.42019-09-15

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

lumenportpaymentgatewaypaypalBankpayiranzarinpalPaylineshaparaksamanMelimellatpasargadparsiansadadjahanpayasan pardakhtpardakhtdargahiranian-bankspersian-bankspoolportipaypay-ir

### Embed Badge

![Health badge](/badges/hamraa-lumen-payment/health.svg)

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

###  Alternatives

[larabook/gateway

A Laravel package for connecting to all Iraninan payment gateways

24553.7k](/packages/larabook-gateway)[parsisolution/gateway

A Laravel package for connecting to all Iraninan payment gateways

231.7k](/packages/parsisolution-gateway)[shetabit/multipay

PHP Payment Gateway Integration Package

291348.2k3](/packages/shetabit-multipay)

PHPackages © 2026

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