PHPackages                             malekfar/zarinpal - 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. malekfar/zarinpal

ActiveLibrary[Payment Processing](/categories/payments)

malekfar/zarinpal
=================

transaction request system for zarinpal

014PHP

Since Oct 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Malekfar/zarinpal)[ Packagist](https://packagist.org/packages/malekfar/zarinpal)[ RSS](/packages/malekfar-zarinpal/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

zarinpal-composer-library
=========================

[](#zarinpal-composer-library)

[![Build Status](https://camo.githubusercontent.com/a117bacdc3fd36c77eec1d6942cc79adc79e70da482aa4e397d9e7d990e6171f/68747470733a2f2f7472617669732d63692e6f72672f52544c65722f7a6172696e70616c2d636f6d706f7365722d6c6962726172792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/RTLer/zarinpal-composer-library)[![StyleCI](https://camo.githubusercontent.com/cfca5f09ce414eca9858a00513d7806e5e41c8307b334c002e346be2131b8cc7/68747470733a2f2f7374796c6563692e696f2f7265706f732f33373933373238302f736869656c64)](https://styleci.io/repos/37937280)[![Coverage Status](https://camo.githubusercontent.com/ae733632fd460a35786edf065a2ef388f8a30f5619fd5f83a6c97aa86dccc555/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f52544c65722f7a6172696e70616c2d636f6d706f7365722d6c6962726172792f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/RTLer/zarinpal-composer-library?branch=master)

transaction request library for zarinpal

usage
-----

[](#usage)

### installation

[](#installation)

`composer require malekfar/zarinpal`

### request

[](#request)

```
use Zarinpal\Zarinpal;

$zarinpal = new Zarinpal('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
$zarinpal->enableSandbox(); // active sandbox mod for test env
// $zarinpal->isZarinGate(); // active zarinGate mode
$results = $zarinpal->request(
    "example.com/testVerify.php",          //required
    1000,                                  //required
    'testing',                             //required
    'me@example.com',                      //optional
    '09000000000',                         //optional
    [                          //optional
        "Wages" => [
            "zp.1.1"'=> [
                "Amount"'=> 120,
                "Description"'=> "part 1"
            ],
            "zp.2.5"'=> [
                "Amount"'=> 60,
                "Description"'=> "part 2"
            ]
        ]
    ]
);
echo json_encode($results);
if (isset($results['Authority'])) {
    file_put_contents('Authority', $results['Authority']);
    $zarinpal->redirect();
}
//it will redirect to zarinpal to do the transaction or fail and just echo the errors.
//$results['Authority'] must save somewhere to do the verification
```

### verify

[](#verify)

```
use Zarinpal\Zarinpal;

$zarinpal = new Zarinpal('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX');
$authority = file_get_contents('Authority');
echo json_encode($zarinpal->verify('OK', 1000, $authority));
//'Status'(index) going to be 'success', 'error' or 'canceled'
```

laravel ready
-------------

[](#laravel-ready)

this package is going to work with all kinds of projects, but for laravel i add provider to make it as easy as possible. just add **(if you are using laravel 5.5 or higher skip this one)**:

```
'providers' => [
    ...
    Zarinpal\Laravel\ZarinpalServiceProvider::class
    ...
]
```

to providers list in "config/app.php". then add this to `config/services.php`

```
'zarinpal' => [
    'merchantID' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
    'zarinGate' => false,
    'sandbox' => false,
],
```

and you are good to go (legacy config still works) now you can access the zarinpal lib like this:

```
use Zarinpal\Laravel\Facade\Zarinpal;

$results = Zarinpal::request(
    "example.com/testVerify.php",          //required
    1000,                                  //required
    'testing',                             //required
    'me@example.com',                      //optional
    '09000000000',                         //optional
    [                          //optional
        "Wages" => [
            "zp.1.1" => [
                "Amount" => 120,
                "Description" => "part 1"
            ],
            "zp.2.5" => [
                "Amount" => 60,
                "Description" => "part 2"
            ]
        ]
    ]
);
// save $results['Authority'] for verifying step
Zarinpal::redirect(); // redirect user to zarinpal

// after that verify transaction by that $results['Authority']
Zarinpal::verify('OK',1000,$results['Authority']);
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

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/99f19c7ca787c28d131a6231ef111624290854b87c00f4ae3f9243db02bd4d9e?d=identicon)[malekfar](/maintainers/malekfar)

---

Top Contributors

[![Malekfar](https://avatars.githubusercontent.com/u/33530385?v=4)](https://github.com/Malekfar "Malekfar (3 commits)")

### Embed Badge

![Health badge](/badges/malekfar-zarinpal/health.svg)

```
[![Health](https://phpackages.com/badges/malekfar-zarinpal/health.svg)](https://phpackages.com/packages/malekfar-zarinpal)
```

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