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

ActiveLibrary[Payment Processing](/categories/payments)

armezit/zarinpal
================

transaction request system for zarinpal

v1.3.3(7y ago)016GPL-2.0-onlyPHP

Since Jul 1Pushed 3y agoCompare

[ Source](https://github.com/armezit/zarinpal-composer-library)[ Packagist](https://packagist.org/packages/armezit/zarinpal)[ RSS](/packages/armezit-zarinpal/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (17)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 zarinpal/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

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 82.9% 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.

###  Release Activity

Cadence

Every ~84 days

Recently: every ~64 days

Total

15

Last Release

2778d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a703c4312d493c2434e8f560bec9706635f7f60c72c0378c9d27eb8dbb5f3e7b?d=identicon)[armezit](/maintainers/armezit)

---

Top Contributors

[![hoomanna](https://avatars.githubusercontent.com/u/5413073?v=4)](https://github.com/hoomanna "hoomanna (63 commits)")[![armezit](https://avatars.githubusercontent.com/u/2006991?v=4)](https://github.com/armezit "armezit (6 commits)")[![rfmhb2](https://avatars.githubusercontent.com/u/16733920?v=4)](https://github.com/rfmhb2 "rfmhb2 (2 commits)")[![amiri27](https://avatars.githubusercontent.com/u/1594140?v=4)](https://github.com/amiri27 "amiri27 (2 commits)")[![majidgolshadi](https://avatars.githubusercontent.com/u/5164297?v=4)](https://github.com/majidgolshadi "majidgolshadi (1 commits)")[![thisismzm](https://avatars.githubusercontent.com/u/12869372?v=4)](https://github.com/thisismzm "thisismzm (1 commits)")[![zartosht](https://avatars.githubusercontent.com/u/6488633?v=4)](https://github.com/zartosht "zartosht (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[chargebee/chargebee-php

ChargeBee API client implementation for PHP

768.0M9](/packages/chargebee-chargebee-php)[imdhemy/google-play-billing

Google Play Billing

491.3M5](/packages/imdhemy-google-play-billing)[bitpay/sdk

Complete version of the PHP library for the new cryptographically secure BitPay API

42337.5k4](/packages/bitpay-sdk)[buckaroo/sdk

Buckaroo payment SDK

12189.1k9](/packages/buckaroo-sdk)[contica/facturador-electronico-cr

Un facturador de código libre para integrar facturación electrónica en Costa Rica a un proyecto PHP

2128.8k](/packages/contica-facturador-electronico-cr)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)

PHPackages © 2026

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