PHPackages                             shahinsoft/irbanks - 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. shahinsoft/irbanks

ActiveLibrary[Payment Processing](/categories/payments)

shahinsoft/irbanks
==================

Iranian banks payment gateways interface

v3.2(2y ago)08MITPHPPHP &gt;=7.1

Since Jul 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/shahind/irbanks)[ Packagist](https://packagist.org/packages/shahinsoft/irbanks)[ Docs](https://github.com/sdarvish/irbanks)[ RSS](/packages/shahinsoft-irbanks/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

IRbanks
=======

[](#irbanks)

Iranian banks payment gateways Interface

Introduction
------------

[](#introduction)

This library provides a simple and easy way to accept payments using Iranian banks with PHP.

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

[](#installation)

simply install IRbanks using composer:

```
composer require shahinsoft/irbanks

```

How to use?
-----------

[](#how-to-use)

Each bank has its own payment process, end-points, and parameters. First of all you need to know about the process of your bank. Then refer to your bank section in this document.

### Mellat

[](#mellat)

Mellat payment has 3 main steps; getting the payment toke, verifying the payment, and settling the payment.

#### 1. Get payment token

[](#1-get-payment-token)

```
try{
    $mellat = new \IRbanks\Mellat($terminalId, $userName, $userPassword);
    $response = $mellat->request($amount);
}catch(\Throwable $e){
    echo "error: ".$e->getMessage();
}
```

#### 2. Redirect user to payment page

[](#2-redirect-user-to-payment-page)

```
//use $response info like token($response->token) and orderId($response->order_id) to create a HTML form with POST method
//or automatically do it using redirectToMellat() function
    $response->redirectToMellat();

//This function generates a JS script which creates a hidden HTML form with POST method to redirect the end-user to the Mellat payment page.
```

#### 3. Verify payment

[](#3-verify-payment)

```
try{
    $mellat = new \IRbanks\Mellat($terminalId, $userName, $userPassword);
    $response = $mellat->verify();
    update_your_payment_with($response->reference_id,$response->order_id,$response->card_number);
    echo "successful payment";
}catch(\Throwable $e){
    //payment was unsuccessful or verification failed
    echo "error: ".$e->getMessage();
}
```

### Parsian

[](#parsian)

Parsian payment has 3 main steps; getting the payment token, redirecting user to payment page, and verifying the payment. There is a possibility to reverse a transaction as well. (Last test: 25 July 2023)

#### 1. Get payment token

[](#1-get-payment-token-1)

```
