PHPackages                             mjedari/mellat-pay - 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. mjedari/mellat-pay

ActiveLibrary[Payment Processing](/categories/payments)

mjedari/mellat-pay
==================

Iranian Mellat Bank gateway package

514PHP

Since Feb 21Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mjedari/mellat-pay)[ Packagist](https://packagist.org/packages/mjedari/mellat-pay)[ RSS](/packages/mjedari-mellat-pay/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![](https://raw.githubusercontent.com/mjedari/mellat-pay/master/art/banner.png)](https://raw.githubusercontent.com/mjedari/mellat-pay/master/art/banner.png)

Iranian Mellat bank full online payment service
===============================================

[](#iranian-mellat-bank-full-online-payment-service)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e5e4d75c6a00b60c14f16291cafb925bcd1ba3ac3f2710f61ae15d49d1d910b6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6a65646172692f6d656c6c61742d7061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mjedari/mellat-pay)[![GitHub Tests Action Status](https://camo.githubusercontent.com/be6ff425de09dc5a2af36c5b4893590fbf7f4f425c2de769976821f0d59d33e3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d6a65646172692f6d656c6c61742d7061792f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/mjedari/mellat-pay/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f8ebb58f9d347bdb4eec81f54d71cb114ca05b50b573dbae7c33f9cf58785065/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d6a65646172692f6d656c6c61742d7061792f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/mjedari/mellat-pay/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/14f31aeb545ea95da6353fa201ea76fa88e11a9b0ad827f4bc8d23a077f626c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6a65646172692f6d656c6c61742d7061792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mjedari/mellat-pay)

Dedicated laravel package for Behpadakht Mellat bank payment service.

Features
--------

[](#features)

- Event calls
- Log on channels
- builtin rate limiter

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

[](#installation)

You can install the package via composer:

```
composer require mjedari/mellat-pay
```

You can publish and run the migrations and all assets with:

```
php artisan vendor:publish --tag="mellat-pay"
php artisan migrate
```

You can publish assets separately:

```
php artisan vendor:publish --tag="mellat-pay-config"

php artisan vendor:publish --tag="mellat-pay-views"

php artisan vendor:publish --tag="mellat-pay-lang"
```

This is the contents of the published config file that you should customize it. Its essential to set `credentials` before any testing. `callback` is your default callback. You can change package tables name by modifying `table`. All exceptions an messages will be under your package `local` language.

```
return [

    /*
    * Language for errors and messages:
    *
    */
    'local' => 'fa', //en

    /*
    * Description of credentials:
    *
    */
    'credentials' => [
        'username'     => '',
        'password'     => '',
        'terminalId'   => 0000000,
    ],

    /*
    * Gateway's default callback:
    *
    */
    'callback' => '/callback',

    /*
    * Description of table name:
    *
    */
    'table' => 'mellat_transactions',

];
```

There is one view file that is bank redirector. Optionally, you can publish that and modify for any customizing usage by using

```
php artisan vendor:publish --tag="mellat-pay"
```

Simple Usage
------------

[](#simple-usage)

There are there main steps. First you should initiate gateway in this way:

```
// initiate transaction and redirect to bank

$gateway = MellatPay::price(10000)
    ->callback('/payment/callback')
    ->ready();

return $gateway->redirect();
```

If every this was ok, it redirects you to bank payment page. Then you should define an callback route and wait for bank callback request:

```
// payment callback route

$gateway = MellatPay::confirm()
    ->then(function ($response) {
        // transaction succeeded and response is transaction full info:
        return $response;
    })->catch(function ($e) {
        // you can get error occurred in transaction verify process:
        return $e->getMessage();
    });
```

Advance Usage
-------------

[](#advance-usage)

### Transaction payable relation

[](#transaction-payable-relation)

You can specify transaction to other models with `payable` method on `MellatPay` facade. But before that make sure you added `payable` trait to your related model:

```
// in your related modal

namespace App\Models;

use Mjedari\MellatPay\Traits\Payable;

class Product extends Model
{
    use payable; // price(10000)->ready();
```

### Set optional values

[](#set-optional-values)

there are some options in payment request. you can set `description`, `callback`, `payer`, `mobile`, `payable` for each transaction.

**Important:**

- If you do not specify `callback` url, the default one will be used.
- `mobile` is useful to send bank and it will be used to autocomplete gateway inputs according to the user's pervious payment card info.

```
// initiate route full example

    $product = Product::find(245);

    $gateway = MellatPay::payable($product)
    ->price(10000) // description("This is a description") // callback("https://example.dev/callback/product/245") // payer(1) // mobile("989102128582") // ready();

    return $gateway->redirect();
```

### Passing custom variables into redirect page

[](#passing-custom-variables-into-redirect-page)

If you want to modify the redirector file, after publishing the view file you can pass any variable into that file by calling this method when redirecting.

```
// initiate and redirect route

$wallet = Wallet::find(1);
$product = Product::find(1);

$gateway->with($product, $wallet)->redirect();
// or
$gateway->with(['product' => $product, 'wallet' => $wallet]) ...
//or
$gateway->with($product) ...
```

\**Note that transaction info is already accessible by `$transaction`.*

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mahdi Jedari](https://github.com/mjedari)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity27

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/455b4467ff09733bf4229d59580ef9e6b4a350a30b414ec3c8a97db555083a1b?d=identicon)[mjedari](/maintainers/mjedari)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/mjedari-mellat-pay/health.svg)

```
[![Health](https://phpackages.com/badges/mjedari-mellat-pay/health.svg)](https://phpackages.com/packages/mjedari-mellat-pay)
```

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