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

AbandonedArchivedLibrary[Payment Processing](/categories/payments)

alighasemzadeh/gateway
======================

A Laravel package for connecting to all Iraninan payment gateways

02PHP

Since Apr 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/alighasemzadeh/gateway)[ Packagist](https://packagist.org/packages/alighasemzadeh/gateway)[ RSS](/packages/alighasemzadeh-gateway/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Parsisolution Gateway
=====================

[](#parsisolution-gateway)

Iranian Payment Gateways

This library is inspired by laravel [Socialite](https://github.com/laravel/socialite) and [PoolPort](https://github.com/PoolPort/PoolPort) and [larabook/gateway](https://github.com/larabook/gateway) and [ShirazSoft/Gateway](https://github.com/ShirazSoft/Gateway)

Available PSPs (Bank):

1. Beh Pardakht (MELLAT)
2. SADAD (MELLI)
3. SEP (SAMAN)
4. PEC (PARSIAN)
5. Mabna **V1** `old method`
6. Mabna **V2** `new method`
7. Asan Pardakht
8. IranKish

Available 3rd-parties:

1. Pay.ir
2. ZarinPal
3. JibIt
4. PayPing
5. NextPay
6. SizPay
7. SabaPay (Saba Novin)
8. Pardano

Install
-------

[](#install)

### Step 1:

[](#step-1)

```
composer require parsisolution/gateway
```

### Step 2:

[](#step-2)

```
php artisan vendor:publish --provider="Alighasemzadeh\Gateway\GatewayServiceProvider"
```

### Step 3:

[](#step-3)

```
php artisan migrate
```

### Step 4:

[](#step-4)

Change `config/gateways.php` fields to your specifications.

Usage
-----

[](#usage)

### Step 1:

[](#step-1-1)

Get instance of Gateway from Gateway Facade `Gateway::of('mellat')`Or create one yourself: `new Mellat(app(), config('gateways.mellat'));` Or

```
new Mellat(app(), [
    'username'     => '',
    'password'     => '',
    'terminalId'   => 0000000,
    'callback-url' => '/'
]);
```

### Step2:

[](#step2)

Then to create new payment transaction you can do like this:

```
try {
    $gateway = Gateway::of('zarinpal'); // $gateway = new Zarinpal(app(), config('gateways.zarinpal'));
    $gateway->callbackUrl(route('callback')); // You can change the callback

    // You can make it stateless.
    // in default mode it uses session to store and retrieve transaction id
    // (and other gateway specific or user provided (using $gateway->with) required parameters)
    // but in stateless mode it get transaction id and other required parameters from callback url
    // Caution: you should use same stateless value in callback too
    $gateway->stateless();

    // Then you should create a transaction to be processed by the gateway
    // Amount is in `Toman` by default but you can set the currency in second argument as well. IRR (for `Riyal`)
    $transaction = new RequestTransaction(new Amount(12000)); // 12000 Toman
    $transaction->setExtra([
        'mobile' => '9122628796', // mobile of payer (for zarinpal)
        'email'  => 'ali@gmail.com', // email of payer (for zarinpal)
    ]);
    $transaction->setExtraField('description', 'توضیحات من');
    $authorizedTransaction = $gateway->authorize($transaction);

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

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

    return $gateway->redirect($authorizedTransaction);

} catch (\Exception $e) {

    echo $e->getMessage();
}
```

### Step3:

[](#step3)

And in callback

```
try {

    $settledTransaction = Gateway::settle(true); // true argument for stateless
    $trackingCode = $settledTransaction->getTrackingCode();
    $refId = $settledTransaction->getReferenceId();
    $cardNumber = $settledTransaction->getCardNumber();

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

} catch (\Alighasemzadeh\Gateway\Exceptions\RetryException $e) {

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

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

} catch (\Exception $e) {

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

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/343c1e5a97c9d4798487a448349575d53172304e98566460c87cb03837a9824d?d=identicon)[aliqasemzadeh](/maintainers/aliqasemzadeh)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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