定制 abolfazlahmadiweb/laravel-zarinpal 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固