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

ActiveLibrary[Payment Processing](/categories/payments)

vahidalvandi/zarinpal
=====================

transaction request system for zarinpal

1.3.4(5y ago)3111GPL-2.0-onlyPHP

Since Jul 1Pushed 5y agoCompare

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

READMEChangelog (1)Dependencies (3)Versions (18)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 vahidalvandi/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

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 86.3% 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 ~119 days

Recently: every ~212 days

Total

16

Last Release

2173d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/460dbe742346b9f2dd0abf8c1b9198692629639475e90ec173ecf7480bd584e5?d=identicon)[vahidalvandi](/maintainers/vahidalvandi)

---

Top Contributors

[![hoomanna](https://avatars.githubusercontent.com/u/5413073?v=4)](https://github.com/hoomanna "hoomanna (63 commits)")[![vahidalvandi](https://avatars.githubusercontent.com/u/7871623?v=4)](https://github.com/vahidalvandi "vahidalvandi (3 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)")[![thisismzm](https://avatars.githubusercontent.com/u/12869372?v=4)](https://github.com/thisismzm "thisismzm (1 commits)")[![majidgolshadi](https://avatars.githubusercontent.com/u/5164297?v=4)](https://github.com/majidgolshadi "majidgolshadi (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/vahidalvandi-zarinpal/health.svg)

```
[![Health](https://phpackages.com/badges/vahidalvandi-zarinpal/health.svg)](https://phpackages.com/packages/vahidalvandi-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)
