PHPackages                             iranrenter-group/laravel-online-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. iranrenter-group/laravel-online-payment

ActiveLibrary[Payment Processing](/categories/payments)

iranrenter-group/laravel-online-payment
=======================================

Iranian payment gateways handler for laravel applicationss

v5.9(3y ago)2284MITPHPPHP &gt;=7.0

Since Jan 11Pushed 3y ago1 watchersCompare

[ Source](https://github.com/iranrenter-group/laravel-online-payment)[ Packagist](https://packagist.org/packages/iranrenter-group/laravel-online-payment)[ RSS](/packages/iranrenter-group-laravel-online-payment/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (9)Dependencies (1)Versions (22)Used By (0)

[![BCH compliance](https://camo.githubusercontent.com/5c899820bf6778d8c3490032cdf53b4ec28df0ce5ce3767747f568934b152986/68747470733a2f2f626574746572636f64656875622e636f6d2f656467652f62616467652f6972616e72656e7465722d67726f75702f6c61726176656c2d6f6e6c696e652d7061796d656e743f6272616e63683d6d6173746572)](https://bettercodehub.com/)

Laravel Online Payment :: LaraPay component
===========================================

[](#laravel-online-payment--larapay-component)

Online Payment Module handler for Laravel 5+ known as LaraPay component completely compatible with [banktest.ir](http://banktest.ir) simulator

What is B‌anktest?
------------------

[](#what-is-b‌anktest)

- [BankTest](http://banktest.ir) is a sandbox service for all Iranian online payment gateways
- [بانک تست](http://banktest.ir) یک سرویس شبیه ساز درگاه های پرداخت آنلاین ایرانی برای اهداف توسعه وتست نرم افزار می باشد

Currenctly support:
-------------------

[](#currenctly-support)

- Mellat Bank Gateway - درگاه بانک ملت لاراول
- Saman Bank Gateway - درگاه بانک سامان لاراول
- Saderat Bank Gateway - درگاه بانک صادرات لاراول
- Pasargad Bank Gateway - درگاه بانک پاسارگاد لاراول
- Parsian Bank Gateway - درگاه بانک پارسیان لاراول
- Melli Bank Gateway (Sadad) - درگاه بانک ملی / سداد لاراول
- Pay.ir Gateway / درگاه پرداخت پی

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

[](#installation)

1.Installing via composer

```
composer require tartan/laravel-online-payment:"^5.0"
```

2.Add this to your app service providers for laravel version &lt; 5.4 :

```
Tartan\Larapay\LarapayServiceProvider::class,
```

3.Add this to your aliases :

```
'Larapay' => Tartan\Larapay\Facades\Larapay::class,
```

4.Publish the package assets and configs

```
php artisan vendor:publish
```

5. Preparing your db (eloquent) model for larapay integration

    - Your Transaction/Invoice (Eloquent) model MUST implement

```
namespace App\Model;

use Tartan\Larapay\Transaction;

class Transaction extends Model implements TransactionInterface
{
    // set order reference Id
	public function setReferenceId($referenceId, $save = true){}

    // check if you transaction is ready for requesting payment token
	public function checkForRequestToken(){}

    // check if transaction is ready for requesting verify transaction
	public function checkForVerify(){}

    // check if transaction is ready for requesting inqury transaction (if supported by gateway)
	public function checkForInquiry(){}

    // check if transaction is ready for requesting reverse transaction (if supported by gateway)
	public function checkForReverse(){}

    // check if transaction is ready for requesting settle/... transaction (if needed by gateway)
	public function checkForAfterVerify(){}

    // update transaction by paid card number (if provided by gateway)
	public function setCardNumber($cardNumber){}

    // mark transaction as verified
	public function setVerified(){}

    // mark transaction as settled/...
	public function setAfterVerified(){}

    // mark transaction as completed
	public function setSuccessful($flag){}

    // mark transaction as reversed
	public function setReversed(){}

    // get transaction amount
	public function getAmount(){}

    // set transactions's paid tme
	public function setPaidAt($time = 'now'){}

    // set transaction's extra details
	public function setExtra($key, $value, $save = false){}
}
```

6. Prepare for online payment

```
    public function payOnline (Request $request, Transaction $transaction)
    {
        // check if the selected payment is active or not from your gateways table
        $paymentGateway = Gateway::activeGate()
            ->where('slug', $request->input('by_online_gateway'))
            ->first();

        if (empty($paymentGateway)) {
            return view('gateway.notfound');
        }

        // get some additional parameters for updating transaction
        $parameters = [
            'description' => $request->input('by_online_description', ''),
            'bank'        => $request->input('by_online_gateway'),
        ];

        // update transaction payment method
        $transaction = $this->transactionsRepository->setTransactionPaid(
            $transaction, TransactionPayment::ONLINE, $parameters
        );

        // make larapay payment gateway instance
        $paymentGatewayHandler = Larapay::make($paymentGateway->slug, $transaction);

        // set payment params
        $paymentParams = [
            'order_id'     => $transaction->getBankOrderId(),
            'redirect_url' => route('payment.callback', [
                'bank' => $paymentGateway->slug,
                'transactionId' => $transaction->guid
            ]),
            'amount'       => $transaction->amount,
            'submit_label' => trans('larapay::larapay.goto_gate')
        ];

        try {
            // get goto gate form
            $form = $paymentGatewayHandler->form($paymentParams);
        } catch (\Exception $e) {
            // could not generate goto gate form
            Log::emergency($paymentGateway->slug . ' #' . $e->getCode() . '-' . $e->getMessage());
            Session::flash('alert-danger', trans('trans.could_not_create_goto_bank_form', ['gateway' => $paymentGateway->name]));

            return redirect()->back()->withInput();
        }
        if (is_null($form)) {
            return redirect()->back()->withInput();
        }

        // view goto gate view
        return view('gateway.gotogate', [
            'gateway'     => $paymentGateway,
            'form'        => $form,
        ]);
    }
```

Component Configuration
-----------------------

[](#component-configuration)

```
return [

	/*
	|--------------------------------------------------------------------------
	| Tartan e-payment component`s operation mode
	|--------------------------------------------------------------------------
	|
	| *** very important config ***
	| please do not change it if you don't know what BankTest is
	|
	| > production: component operates with real payments gateways
	| > development: component operates with simulated "BankTest" (banktest.ir) gateways
	|
	*/
	'mode'     => env('LARAPAY_MODE', 'production'),

	/*
	|--------------------------------------------------------------------------
	| ready to serve gateways
	|--------------------------------------------------------------------------
	|
	| specifies ready to serve gateways.
	| gateway characters are case sensitive and should be exactly same as their folder name.
	|    eg, "Jahanpay" is correct not "JahanPay" or "jahanpay"
	| the gateways list is comma separated
	|
	*/
	'gateways' => env('LARAPAY_GATES', 'Mellat,Saman,Pasargad'),

	/*
	|--------------------------------------------------------------------------
	| Mellat gateway configuration
	|--------------------------------------------------------------------------
	*/
	'mellat'   => [
		'username'     => env('MELLAT_USERNAME', ''),
		'password'     => env('MELLAT_PASSWORD',''),
		'terminal_id'  => env('MELLAT_TERMINAL_ID', ''),
		'callback_url' => env('MELLAT_CALLBACK_URL', '')
	],

	/*
	|--------------------------------------------------------------------------
	| Parsian gateway configuration
	|--------------------------------------------------------------------------
	*/
	'parsian'  => [
		'pin'          => env('PARSIAN_PIN', ''),
	],
	/*
	|--------------------------------------------------------------------------
	| Pasargad gateway configuration
	|--------------------------------------------------------------------------
	*/
	'pasargad' => [
		'terminalId'       => env('PASARGAD_TERMINAL_ID', ''),
		'merchantId'       => env('PASARGAD_MERCHANT_ID', ''),
		'certificate_path' => storage_path(env('PASARGAD_CERT_PATH', 'payment/pasargad/certificate.xml')),
		'callback_url'     => env('PASARGAD_CALLBACK_URL', '')
	],

	/*
	|--------------------------------------------------------------------------
	| Sadad gateway configuration
	|--------------------------------------------------------------------------
	*/
	'sadad'    => [
		'merchant'        => env('SADAD_MERCHANT', ''),
		'transaction_key' => env('SADAD_TRANS_KEY', ''),
		'terminal_id'     => env('SADAD_TERMINAL_ID', ''),
		'callback_url'    => env('SADAD_CALLBACK_URL', ''),
	],

	'saderat' => [
		'MID' => env('SADERAT_MID', ''),
		'TID' => env('SADERAT_TID', ''),
		'public_key_path' => storage_path(env('SADERAT_CERT_PATH', 'payment/saderat/public.key')),
		'private_key_path' => storage_path(env('SADERAT_CERT_PATH', 'payment/saderat/private.key')),
	],

	/*
	|--------------------------------------------------------------------------
	| Saman gateway configuration
	|--------------------------------------------------------------------------
	*/
	'saman'    => [
		'merchant_id'   => env('SAMAN_MERCHANT_ID', ''),
		'merchant_pass' => env('SAMAN_MERCHANT_PASS', ''),
	],

	/*
	|--------------------------------------------------------------------------
	| Zarinpal gateway configuration
	|--------------------------------------------------------------------------
	|
	| types: acceptable values  --- zarin-gate or normal
	| server: acceptable values --- germany or iran or test
	|
	*/
	'zarinpal' => [
		'merchant_id'  => env('ZARINPAL_MERCHANT_ID', ''),
		'type'         => env('ZARINPAL_TYPE', 'zarin-gate'),
		'callback_url' => env('ZARINPAL_CALLBACK_URL', ''),
		'server'       => env('ZARINPAL_SERVER', 'germany'),
		'email'        => env('ZARINPAL_EMAIL', ''),
		'mobile'       => env('ZARINPAL_MOBILE', '09xxxxxxxxx'),
		'description'  => env('ZARINPAL_MOBILE', 'powered-by-TartanPayment'),
	],
	/*
	|--------------------------------------------------------------------------
	| Pay.ir gateway configuration
	|--------------------------------------------------------------------------
	*/
	'pay_ir'    => [
        	'api'   => env('PAY_IR_API_KEY', ''),
    	],

    /*
    |--------------------------------------------------------------------------
    | SoapClient Options
    |--------------------------------------------------------------------------
    |
    | useOptions: true/false
    | options: soapClient Options
    |
    */
    'soap' => [
        'useOptions' => env('SOAP_HAS_OPTIONS', false),
        'options' => [
            'proxy_host' => env('SOAP_PROXY_HOST', ''),
            'proxy_port' => env('SOAP_PROXY_PORT', ''),
            'stream_context' => stream_context_create(
                [
                    'ssl' => [
                        'verify_peer' => false,
                        'verify_peer_name' => false,
                    ],
                ]
            ),
        ]
    ]
];
```

Team
----

[](#team)

This component is developed by the following person(s) and a bunch of [awesome contributors](https://github.com/iamtartan/laravel-online-payment/graphs/contributors).

[![Aboozar Ghaffari](https://avatars2.githubusercontent.com/u/502961?v=3&s=130)](https://github.com/iamtartan)[Aboozar Ghaffari](https://github.com/iamtartan)Support This Project
--------------------

[](#support-this-project)

[![Donate via Paypal](https://camo.githubusercontent.com/7b6de155df30b37b25eb5fec52f9213680c3dbf067dfb7d7e2850ac4096c7d05/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f55532f692f62746e2f62746e5f646f6e6174655f534d2e676966)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LXEL22GFTXTKN)

### License

[](#license)

The Laravel Online Payment Module is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~54 days

Total

17

Last Release

1373d ago

Major Versions

v2.0.2 → v5.0.02018-06-20

PHP version history (2 changes)v2.0.0PHP &gt;=5.4.0

v5.5PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b7c4568e5f975dd39deae39875dff41c748c48b07ac6d3dbe623adc63bb3a645?d=identicon)[iranrenter-group](/maintainers/iranrenter-group)

---

Top Contributors

[![sinamiandashti](https://avatars.githubusercontent.com/u/195868?v=4)](https://github.com/sinamiandashti "sinamiandashti (9 commits)")[![iamfarhad](https://avatars.githubusercontent.com/u/1936147?v=4)](https://github.com/iamfarhad "iamfarhad (7 commits)")[![samuraee](https://avatars.githubusercontent.com/u/502961?v=4)](https://github.com/samuraee "samuraee (6 commits)")[![iranrenter-group](https://avatars.githubusercontent.com/u/42575732?v=4)](https://github.com/iranrenter-group "iranrenter-group (4 commits)")[![timcheh](https://avatars.githubusercontent.com/u/76466369?v=4)](https://github.com/timcheh "timcheh (3 commits)")[![mohammad-fouladgar](https://avatars.githubusercontent.com/u/13538673?v=4)](https://github.com/mohammad-fouladgar "mohammad-fouladgar (1 commits)")[![iranrenterdevelopment](https://avatars.githubusercontent.com/u/29946147?v=4)](https://github.com/iranrenterdevelopment "iranrenterdevelopment (1 commits)")

---

Tags

paymentgatewayBankiranonline-paymentshetab

### Embed Badge

![Health badge](/badges/iranrenter-group-laravel-online-payment/health.svg)

```
[![Health](https://phpackages.com/badges/iranrenter-group-laravel-online-payment/health.svg)](https://phpackages.com/packages/iranrenter-group-laravel-online-payment)
```

###  Alternatives

[omalizadeh/laravel-multi-payment

A driver-based laravel package for online payments via multiple gateways

491.1k](/packages/omalizadeh-laravel-multi-payment)[dena-a/iran-payment

a Laravel package to handle Internet Payment Gateways for Iran Banking System

312.4k1](/packages/dena-a-iran-payment)[parsisolution/gateway

A Laravel package for connecting to all Iraninan payment gateways

231.7k](/packages/parsisolution-gateway)

PHPackages © 2026

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