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

ActiveLibrary[Payment Processing](/categories/payments)

huseinghasemi/zarinpal
======================

Zarinpal library for Laravel.

v5.1.0(1y ago)09MITPHPPHP ^7.2|^8.0

Since Jul 29Pushed 1y agoCompare

[ Source](https://github.com/huseinghasemi/Zarinpal)[ Packagist](https://packagist.org/packages/huseinghasemi/zarinpal)[ Docs](https://github.com/huseinghasemi/zarinpal)[ RSS](/packages/huseinghasemi-zarinpal/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (23)Used By (0)

زرین پال | Zarinpal
===================

[](#زرین-پال--zarinpal)

Zarinpal library for Laravel based on Zarinpal API v4

کتابخانه زرین پال برای لاراول براساس نسخه 4 ای‌پی‌آی زرین پال

روش نصب - Installation
----------------------

[](#روش-نصب---installation)

Use composer to install this package

برای نصب و استفاده از این پکیج می توانید از کمپوسر استفاده کنید

```
composer require huseinghasemi/zarinpal
```

تنظیمات - Configuration
-----------------------

[](#تنظیمات---configuration)

Add your merchant id to .env file

مرچنت کد خود را اضافه کنید

```
ZARINPAL_MERCHANT_ID=00000000-0000-0000-0000-000000000000
```

You can also define merchant id at runtime.

امکان تعیین مرچنت کد در حین اجرا نیز وجود دارد که در ادامه توضیح داده خواهد شد.

To change currency to Toman (Default)

برای تغییر واحد پول به تومان (مقدار پیشفرض)

```
ZARINPAL_CURRENCY=IRT
```

To change currency to Rial

برای تغییر واحد پول به ریال

```
ZARINPAL_CURRENCY=IRR
```

To change payment type to test gateway

برای تغییر وضعیت درگاه به تست (به طور پیشفرض false هست. که اگر نیاز به درگاه تست هست کد پایین رو به dotenv اضافه کنید)

```
ZARINPAL_SANDBOX=TRUE
```

روش استفاده | How to use
------------------------

[](#روش-استفاده--how-to-use)

### ارسال مشتری به درگاه پرداخت | Send customer to payment gateway

[](#ارسال-مشتری-به-درگاه-پرداخت--send-customer-to-payment-gateway)

```
$response = zarinpal()
    ->merchantId('00000000-0000-0000-0000-000000000000') // تعیین مرچنت کد در حین اجرا - اختیاری
    ->amount(100) // مبلغ تراکنش
    ->request()
    ->description('transaction info') // توضیحات تراکنش
    ->callbackUrl('https://domain.com/verification') // آدرس برگشت پس از پرداخت
    ->mobile('09123456789') // شماره موبایل مشتری - اختیاری
    ->email('name@domain.com') // ایمیل مشتری - اختیاری
    ->send();

if (!$response->success()) {
    return $response->error()->message();
}

// ذخیره اطلاعات در دیتابیس
// $response->authority();

// هدایت مشتری به درگاه پرداخت
return $response->redirect();
```

### بررسی وضعیت تراکنش | Verify payment status

[](#بررسی-وضعیت-تراکنش--verify-payment-status)

```
$authority = request()->query('Authority'); // دریافت کوئری استرینگ ارسال شده توسط زرین پال
$status = request()->query('Status'); // دریافت کوئری استرینگ ارسال شده توسط زرین پال

$response = zarinpal()
    ->merchantId('00000000-0000-0000-0000-000000000000') // تعیین مرچنت کد در حین اجرا - اختیاری
    ->amount(100)
    ->verification()
    ->authority($authority)
    ->send();

if (!$response->success()) {
    return $response->error()->message();
}

// دریافت هش شماره کارتی که مشتری برای پرداخت استفاده کرده است
// $response->cardHash();

// دریافت شماره کارتی که مشتری برای پرداخت استفاده کرده است (بصورت ماسک شده)
// $response->cardPan();

// پرداخت موفقیت آمیز بود
// دریافت شماره پیگیری تراکنش و انجام امور مربوط به دیتابیس
return $response->referenceId();
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance41

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 71.8% 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 ~96 days

Recently: every ~27 days

Total

22

Last Release

499d ago

Major Versions

v1.x-dev → v2.0.02020-02-01

v2.3 → v4.02021-06-06

v1.0.1 → v5.0.02025-02-19

PHP version history (4 changes)v1.0.0PHP &gt;=7.1.0

v2.1.0PHP ^7.1

v2.3PHP ^7.1|^8.0

v4.0PHP ^7.2|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/77407105?v=4)[Husein Ghasemi](/maintainers/huseinghasemi)[@huseinghasemi](https://github.com/huseinghasemi)

---

Top Contributors

[![FaridAghili](https://avatars.githubusercontent.com/u/8607021?v=4)](https://github.com/FaridAghili "FaridAghili (28 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![huseinghasemi](https://avatars.githubusercontent.com/u/77407105?v=4)](https://github.com/huseinghasemi "huseinghasemi (3 commits)")[![MohammadZarifiyan](https://avatars.githubusercontent.com/u/55022827?v=4)](https://github.com/MohammadZarifiyan "MohammadZarifiyan (1 commits)")

---

Tags

laravelpaymentzarinpal

### Embed Badge

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

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

###  Alternatives

[pishran/zarinpal

Zarinpal library for Laravel.

4630.9k](/packages/pishran-zarinpal)[larabook/gateway

A Laravel package for connecting to all Iraninan payment gateways

24754.1k](/packages/larabook-gateway)[evryn/laravel-toman

A simple stable Laravel package to handle popular payment gateways in Iran including ZarinPal and IDPay.

10710.5k](/packages/evryn-laravel-toman)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.7k](/packages/duncanmcclean-statamic-cargo)[dena-a/iran-payment

a Laravel package to handle Internet Payment Gateways for Iran Banking System

322.4k1](/packages/dena-a-iran-payment)[parsisolution/gateway

A Laravel package for connecting to all Iraninan payment gateways

231.7k](/packages/parsisolution-gateway)

PHPackages © 2026

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