PHPackages                             mst-ghi/larapool - 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. mst-ghi/larapool

ActiveLibrary[Payment Processing](/categories/payments)

mst-ghi/larapool
================

A Laravel library to connect all Iraninan payments gateways

v1.1.0(4y ago)05MITPHP

Since Aug 16Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mst-ghi/larapool)[ Packagist](https://packagist.org/packages/mst-ghi/larapool)[ RSS](/packages/mst-ghi-larapool/feed)WikiDiscussions master Synced 2d ago

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

Larapool
--------

[](#larapool)

### A **Laravel (+7)** package to connect all Iraninan payments gateways

[](#a-laravel-7-package-to-connect-all-iraninan-payments-gateways)

---

### **Active ports** :

[](#active-ports-)

- IDPay
- Mellat
- Sadad
- Zarinpal
- Payline
- Jahanpay
- Saderat
- IranKish
- Saman
- Parsian
- Pay
- JiBit
- AP
- BitPay

---

### **Installing** :

[](#installing-)

##### Step 1 :

[](#step-1-)

```
composer require mst-ghi/larapool
```

##### Step 2 : Apply the following changes to the config/app.php file

[](#step-2--apply-the-following-changes-to-the-configappphp-file)

```
   'providers' => [
         MstGhi\Larapool\LarapoolServiceProvider::class
   ],

  'aliases' => [
        'Larapool' => MstGhi\Larapool\Larapool::class
   ]
```

##### Step 3 : Publishing required files

[](#step-3--publishing-required-files)

```
php artisan vendor:publish
```

Choice and enter number of **MstGhi\\Larapool\\LarapoolServiceProvider** to publish resource files. Published files include config and migration files

##### Step 4 : Create transaction tables

[](#step-4--create-transaction-tables)

```
php artisan migrate
```

---

### Package configs

[](#package-configs)

> The installation operation is complete. Now open the larapool.php file in the **config/larapool.php** and enter the settings related to your desired banking portal.

---

### Create new transaction

[](#create-new-transaction)

> Your project **Order** model must use the **TransactionAble** trait. This trait adds relation **transactions()** to order model
> You have to register the order and then create a transaction for that order

```
$order = Order::create([
    'paid_price' => 1000
    // your data
]);

$resId = \MstGhi\Larapool\LarapoolTransaction::generateResId();

// create new transaction
$order->transactions()->create([
    'user_id' => $user->id, // customer id here, this is optional
    'port_id' => \MstGhi\Larapool\Larapool::P_IDPAY,
    'price' => $order->paid_price,
    'res_id' => $resId,
    'platform' => \MstGhi\Larapool\Larapool::PLATFORM_WEB,
    'last_change_date' => strtotime(now()),
]);

// In the next step, transfer to the bank portal using resId
```

> In the next step, transfer to the bank portal using **$resId**

---

### Redirect to bank

[](#redirect-to-bank)

> Can be redirected directly to the bank portal using the **redirect()**
> or
> Received the relevant link and connected to the bank portal in other ways using the **redirectLink()**
>
> > The choice of redirect method to the bank depends on your project

```
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Log;
use MstGhi\Larapool\LarapoolTransaction;
use MstGhi\Larapool\Larapool;
use MstGhi\Larapool\IDPay\IDPay;
use MstGhi\Larapool\Exceptions\NotFoundTransactionException;

public function redirect($resId)
{
    $exception = null;

    $transaction = LarapoolTransaction::with(['transactionable'])->where('res_id', $resId)->first();

    if (!$transaction) {

        $exception = new NotFoundTransactionException();

    } else {

        /** @var IDPay $larapool */
        $larapool = new Larapool(Larapool::P_IDPAY);

        try {

            $refId = $larapool->setTransaction($transaction)->ready()->refId();
            // any operation on $refId here ...

            /**
            * redirect by php header() method automatically
            */
            $larapool->redirect();

            // Or ...

            /**
            * relevant link and connected to the bank portal in other ways
            */
            $link = $larapool->redirectLink();

            return response()->json([ 'link' => $link ], Response::HTTP_OK);

        } catch (Exception $e) {

            $exception = $e;

        }
    }

    if ($exception) {

        Log::critical(
            "Error in getting payment url: {$exception->getMessage()} #transactionId: {$transaction->id}"
        );

        throw $exception;
    }

}
```

---

### Callback from bank

[](#callback-from-bank)

```
use Illuminate\Support\Facades\Log;
use MstGhi\Larapool\Exceptions\NotFoundTransactionException;
use MstGhi\Larapool\LarapoolTransaction;
use MstGhi\Larapool\Larapool;
use MstGhi\Larapool\IDPay\IDPay;
use Carbon\Carbon;

public function callback(LarapoolTransaction $transaction, $resId)
    {
        if (($transaction && !$resId) || ($transaction && $transaction->res_id != $resId)) {
            throw new NotFoundTransactionException();
        }

        // load transactionable, this is use as orderId
        $transaction->load(['transactionable']);

        try {
             /** @var IDPay $larapool */
             $larapool = new Larapool(Larapool::P_IDPAY);

            /** verify transaction [bank] */
            $larapool->setOrderId($transaction->transactionable->id)->verify($transaction);

            $trackingCode = $larapool->trackingCode();
            $cardNumber = $larapool->cardNumber();

            $transaction->update([
                'tracking_code' => $trackingCode,
                'card_number' => $cardNumber,
                'status' => LarapoolTransaction::TRANSACTION_SUCCEED,
                'payment_date' => strtotime(Carbon::now()),
                'last_change_date' => strtotime(Carbon::now()),
            ]);

            // any operation after success payment here ...

        } catch (\Exception $e) {
            $message = $e->getMessage();
            Log::critical("Error in verifying payment: $message #transactionId: {$transaction->id}");

            $transaction->update([
                'status' => LarapoolTransaction::TRANSACTION_FAILED,
                'last_change_date' => strtotime(Carbon::now()),
            ]);

            // any operation after failed payment here ...
        }
    }
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Total

2

Last Release

1732d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/34771560?v=4)[Mostafa Gholami](/maintainers/mst-ghi)[@mst-ghi](https://github.com/mst-ghi)

---

Top Contributors

[![mst-ghi](https://avatars.githubusercontent.com/u/34771560?v=4)](https://github.com/mst-ghi "mst-ghi (15 commits)")

---

Tags

laravelportpaymentgatewayBankpayiranzarinpalPaylineshaparaksamanMelimellatpasargadparsiansadadjahanpaypardakhtdargahpoolportipaypay-ir

### Embed Badge

![Health badge](/badges/mst-ghi-larapool/health.svg)

```
[![Health](https://phpackages.com/badges/mst-ghi-larapool/health.svg)](https://phpackages.com/packages/mst-ghi-larapool)
```

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