abolfazlahmadiweb/laravel-zarinpal
Composer 安装命令:
composer require abolfazlahmadiweb/laravel-zarinpal
包简介
Simple Laravel package for Zarinpal payment gateway.
README 文档
README
A simple, lightweight and clean Laravel package for integrating the Zarinpal Payment Gateway.
Features
- 🚀 Simple API
- ⚡ Laravel Auto Discovery
- 📦 Publishable configuration
- 🎯 Facade support
- 💉 Dependency Injection support
- 🧩 Laravel 12 & 13 compatible
- 🛠️ Minimal and easy to maintain
Installation
Install the package via Composer:
composer require abolfazlahmadiweb/laravel-zarinpal
Publish Configuration
Publish the configuration file:
php artisan vendor:publish --tag=zarinpal-config
Environment Variables
Add the following variables to your .env file:
ZARINPAL_MERCHANT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ZARINPAL_SANDBOX=true ZARINPAL_CURRENCY=IRT ZARINPAL_MAX_AMOUNT=200000000 ZARINPAL_BASE_URL=https://sandbox.zarinpal.com/pg/v4/payment
Create Payment
use AbolfazlAhmadi\LaravelZarinpal\Facades\Zarinpal; $payment = Zarinpal::request( amount: 100000, description: 'Order #1001', callback: route('payment.callback'), mobile: '09123456789', email: 'user@example.com' ); return redirect()->away($payment['url']);
Response:
[
"authority" => "...",
"url" => "...",
"fee" => "...",
"fee_amount" => ...
]
Verify Payment
use AbolfazlAhmadi\LaravelZarinpal\Facades\Zarinpal; $result = Zarinpal::verify( authority: request('Authority'), amount: 100000 );
Response:
[
"ref_id" => "...",
"card_pan" => "...",
"fee" => "...",
"fee_type" => "..."
]
Using Dependency Injection
use AbolfazlAhmadi\LaravelZarinpal\Services\ZarinpalService; public function __construct( protected ZarinpalService $zarinpal ) { } $payment = $this->zarinpal->request(...);
Configuration
| Key | Description |
|---|---|
| merchant_id | Zarinpal Merchant ID |
| sandbox | Enable Sandbox mode |
| currency | IRT or IRR |
| max_amount | Maximum payment amount |
| base_url | Zarinpal API URL |
Requirements
- PHP 8.2+
- Laravel 12+
- Laravel 13+
License
The MIT License (MIT).
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-09