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

ActiveLibrary[Payment Processing](/categories/payments)

blackplatinum/zarinpal
======================

The Zarinpal gateway implementation for Laravel.

v1.0.1(6y ago)04561MITPHPPHP ^7.1

Since Apr 21Pushed 6y ago1 watchersCompare

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

READMEChangelog (4)DependenciesVersions (5)Used By (0)

Zarinpal payment gateway for Laravel
====================================

[](#zarinpal-payment-gateway-for-laravel)

Installation
------------

[](#installation)

Use \[Composer\] to install the package:

```
$ composer require blackplatinum/zarinpal

```

How To Use:
-----------

[](#how-to-use)

In your config folder open app.php and add following lines:

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

'aliases' => [
    ...........
    'Zarinpal' => BlackPlatinum\Zarinpal\Zarinpal::class,
],
```

Then add your Merchant ID in .env like this:

```
MERCHANT_ID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
```

In the end restart your server. (Also you can ignore adding merchant id to .env and use it in your source code with setMerchantId())

How To Run:
-----------

[](#how-to-run)

```
use BlackPlatinum\Zarinpal\Zarinpal;

/**
 * This is for sending your request to the bank for your payment
 */
$paymentRequest = new Zarinpal(
 'request',
    [
        'price' => 100, // Toman
        'description' => 'درگاه پرداخت زرین پال',
        'callbackUri' => 'your_uri', // Without '/'
        'orderId' => 1 // Your order id
    ], true // Enables sandbox mode
);
$result = $paymentRequest->sendPaymentInfoToGateway();
if ($result->Status == 100) {
    // The information that you have sent was out of mistakes and you are gonna
    // redirect to zarinpal gateway
    return redirect()->to($paymentRequest->linkToGateway($result->Authority));
}

// There is something wrong about your request and you are not qualify to redirect
// to zarinpal gateway
return redirect('your_failure_url_in_payment');

--------------------------------------------------------------------------------------------------

/**
 * This is for receiving your response from the bank about your payment request in previous code
 */
$paymentResponse = new Zarinpal(
'response',
    [
        'price' => 100, // Toman
        'authority' => $request->Authority
    ], true // Enables sandbox mode
);
$result = $paymentResponse->receivePaymentInfoFromGateway($request->Status);
if ($result) {
    // Yor payment done successfully
    $authority = $request->input('Authority');
    $status = $request->input('Status');
    $refId = $result->RefID;
    // Do the rest...
}
else {
    // Yor payment failed or you canceled payment
}
```

Authors
-------

[](#authors)

- \[BlackPlatinum Developers\]
- E-Mail: \[\]

License
-------

[](#license)

All contents of this component are licensed under the \[MIT license\].

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~3 days

Total

4

Last Release

2200d ago

Major Versions

v0.0.2-alpha → v1.0.02020-04-22

### Community

Maintainers

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

---

Top Contributors

[![Baha2rM98](https://avatars.githubusercontent.com/u/49520007?v=4)](https://github.com/Baha2rM98 "Baha2rM98 (2 commits)")

---

Tags

paymentpayment gatewayzarinpal

### Embed Badge

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

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

###  Alternatives

[shetabit/payment

Laravel Payment Gateway Integration Package

944330.1k5](/packages/shetabit-payment)[shetabit/multipay

PHP Payment Gateway Integration Package

291348.2k3](/packages/shetabit-multipay)[larabook/gateway

A Laravel package for connecting to all Iraninan payment gateways

24553.7k](/packages/larabook-gateway)[cybersource/rest-client-php

Client SDK for CyberSource REST APIs

39881.3k6](/packages/cybersource-rest-client-php)[tzsk/payu

PayU India Payment Gateway Integration with Laravel

47108.8k6](/packages/tzsk-payu)[evryn/laravel-toman

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

1079.9k](/packages/evryn-laravel-toman)

PHPackages © 2026

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