PHPackages                             mastani/laravel-idpay - 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. mastani/laravel-idpay

ActiveLibrary[Payment Processing](/categories/payments)

mastani/laravel-idpay
=====================

IDPay payment gateway for Laravel https://idpay.ir

399PHP

Since Apr 6Pushed 4y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

IDPay payment gateway for Laravel ()
======================================================

[](#idpay-payment-gateway-for-laravel-httpsidpayir)

IDPay gateway in Laravel.

[![Total Downloads](https://camo.githubusercontent.com/46f78a78ce0f4972b9952e6c4db7fabf576fa3c6f8335f0db7b00c154756dcce/68747470733a2f2f706f7365722e707567782e6f72672f6d617374616e692f6c61726176656c2d69647061792f646f776e6c6f616473)](https://packagist.org/packages/mastani/laravel-idpay)[![Latest Stable Version](https://camo.githubusercontent.com/f66dddd3ed794581998d406e749abbdc245c96c329f0ba059293670a15de294b/68747470733a2f2f706f7365722e707567782e6f72672f6d617374616e692f6c61726176656c2d69647061792f762f737461626c65)](https://packagist.org/packages/mastani/laravel-idpay)[![Latest Unstable Version](https://camo.githubusercontent.com/da33cefe48f7e81826d2734b043d87e47a8aa6b84496a82c6be55e68e8b74a7a/68747470733a2f2f706f7365722e707567782e6f72672f6d617374616e692f6c61726176656c2d69647061792f762f756e737461626c65)](https://packagist.org/packages/mastani/laravel-idpay)[![License](https://camo.githubusercontent.com/d45283e04769fd47a647db37abdc7bd7b1ddd6b9ec1feadf38bfaa5e9402ebe2/68747470733a2f2f706f7365722e707567782e6f72672f6d617374616e692f6c61726176656c2d69647061792f6c6963656e7365)](https://packagist.org/packages/mastani/laravel-idpay)

Table of contents
=================

[](#table-of-contents)

- [Installation](#installation-in-laravel-55-and-up)
- [Request new payment](#request-new-payment)
- [Handle callback result](#handle-callback-result)
- [Verify payment](#verify-payment)
- [Inquiry an old payment](#inquiry-an-old-payment)
- [Contributors](#contributors)
- [License](#license)

### Installation in Laravel 5.5 and up

[](#installation-in-laravel-55-and-up)

```
$ composer require mastani/laravel-idpay
```

The package will automatically register itself.

### Installation in Laravel 5.4

[](#installation-in-laravel-54)

```
$ composer require mastani/laravel-idpay
```

Next up, the service provider must be registered:

```
// config/app.php

'providers' => [
    ...
    mastani\IDPay\IDPayServiceProvider::class,
];
```

### Installation without Laravel

[](#installation-without-laravel)

Another way is install the component through [composer](https://getcomposer.org/download/).

Either run

```
$ composer require mastani/laravel-idpay
```

or add

```
"mastani/laravel-idpay": "dev-master"
```

to the require section of your composer.json.

Usage
-----

[](#usage)

### Request new payment

[](#request-new-payment)

```
$pay = new IDPayPayment();
$response = $pay->setApiKey('IDPay API Key')
            ->setSandbox(true)
            ->setOrderID('10000') // Locally generated
            ->setCallback('https://my-website.com/callback')
            ->setPrice(50000)
            ->setName("Amin") // optional
            ->setPhone("09353361569") // optional
            ->setMail("amin@mail.com") // optional
            ->setDesc("Pay for bronze account") // optional
            ->request();

if ($response->is_successful) {
    // save payment details to database here

    return redirect()->to($response->link);
} else {
    // handle error
}
```

##### Successful response

[](#successful-response)

```
[response_code] => 201
[is_successful] => true
[id] => 91cb30a55598f6dbdd0d4d7ad9613d88
[link] => https://idpay.ir/p/ws-sandbox/91cb30a55598f6dbdd0d4d7ad9613d88

```

##### Failed response

[](#failed-response)

```
[response_code] => 406
[is_successful] => false
[error_code] => 34
[error_message] => مبلغ `amount` باید بیشتر از 10,000 ریال باشد

```

### Handle callback result

[](#handle-callback-result)

```
$callback = new IDPayPaymentCallback($_POST);

if ($callback->is_successful) {
    echo 'Order: ' . $callback->orderId;
    echo 'Card Number: ' . $callback->cardNO;

    // verify payment with next method
} else {
    // handle error
}

```

##### Successful response

[](#successful-response-1)

```
[is_successful] => false
[result] => "در انتظار تایید پرداخت"
[status] => "10"
[trackID] => "46868"
[ID] => "91cb30a55598f6dbdd0d4d7ad9613d88"
[orderID] => "10000"
[amount] => "50000"
[cardNO] => "123456******1234"
[date] => "1553961021"

```

### Verify payment

[](#verify-payment)

```
$verify = new IDPayVerify();
$response = $verify->setApiKey('IDPay API Key')
            ->setSandbox(true)
            ->setID('91cb30a55598f6dbdd0d4d7ad9613d88')
            ->setOrderID('10000')
            ->request();

if ($response->is_successful) {
    echo 'Order: ' . $response->order_id;
    echo 'Card Number: ' . $response->payment->card_no;

    // handle user credit here
} else {
    // handle error
}
```

##### Successful response

[](#successful-response-2)

```
[response_code] => 200
[is_successful] => true
[status] => 101
[track_id] => 46826
[id] => 91cb30a55598f6dbdd0d4d7ad9613d88
[order_id] => 10000
[amount] => 50000
[date] => 1553954369
[payment] => stdClass Object
(
    [track_id] => 59670764
    [amount] => 50000
    [card_no] => 123456******1234
    [date] => 1553954369
)
[verify] => stdClass Object
(
    [date] => 1553954623
)

```

##### Failed response

[](#failed-response-1)

```
[response_code] => 405
[is_successful] => false
[error_code] => 53
[error_message] => تایید پرداخت امکان پذیر نیست.

```

### Inquiry an old payment

[](#inquiry-an-old-payment)

```
$inquiry = new IDPayInquiry();
$response = $inquiry->setApiKey('IDPay API Key')
            ->setSandbox(true)
            ->setID('91cb30a55598f6dbdd0d4d7ad9613d88')
            ->setOrderID('10000')
            ->request();

if ($response->is_successful) {
    // handle success here

    echo 'Order: ' . $response->order_id;
    echo 'Card Number: ' . $response->payment->card_no;
} else {
    // handle error
}
```

##### Successful response

[](#successful-response-3)

```
[response_code] => 200
[is_successful] => true
[status] => 100
[track_id] => 46826
[id] => 91cb30a55598f6dbdd0d4d7ad9613d88
[order_id] => 10000
[amount] => 50000
[wage] => stdClass Object
(
    [by] => payee
    [type] => percent
    [amount] => 1000
)
[date] => 1553954369
[payer] => stdClass Object
(
    [name] => Amin
    [phone] => 09353361569
    [mail] => amin@mail.com
    [desc] => Pay for bronze account
)
[payment] => stdClass Object
(
    [track_id] => 59670764
    [amount] => 50000
    [card_no] => 123456******1234
    [date] => 1553954369
)
[verify] => stdClass Object
(
    [date] => 1553954623
)
[settlement] => stdClass Object
(
    [track_id] => 13040079970
    [amount] => 47000
    [date] => 1553984280
)

```

##### Failed response

[](#failed-response-2)

```
[response_code] => 400
[is_successful] => false
[error_code] => 52
[error_message] => استعلام نتیجه ای نداشت.

```

Contributor(s)
--------------

[](#contributors)

- Amin Mastani

License
-------

[](#license)

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

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

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://avatars.githubusercontent.com/u/7414851?v=4)[Amin Mastani](/maintainers/mastani)[@mastani](https://github.com/mastani)

---

Top Contributors

[![mastani](https://avatars.githubusercontent.com/u/7414851?v=4)](https://github.com/mastani "mastani (10 commits)")

---

Tags

gatewayidpaylaravelmodulepayment

### Embed Badge

![Health badge](/badges/mastani-laravel-idpay/health.svg)

```
[![Health](https://phpackages.com/badges/mastani-laravel-idpay/health.svg)](https://phpackages.com/packages/mastani-laravel-idpay)
```

###  Alternatives

[omnipay/coinbase

Coinbase driver for the Omnipay payment processing library

18570.2k1](/packages/omnipay-coinbase)

PHPackages © 2026

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