承接 noorani-mm/irankish-laravel-gateway 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

noorani-mm/irankish-laravel-gateway

Composer 安装命令:

composer require noorani-mm/irankish-laravel-gateway

包简介

Laravel package for integrating IranKish payment gateway (درگاه پرداخت ایران کیش برای لاراول)

README 文档

README

Latest Version on Packagist Total Downloads License: MIT Tests

A modern and developer-friendly Laravel integration for the IranKish Payment Gateway (IPG),
implemented fully according to the official technical documentation V9.

🚀 Installation

composer require noorani-mm/irankish-laravel-gateway

⚙️ Configuration

After installation, publish the configuration file:

php artisan vendor:publish --provider="IranKish\IranKishServiceProvider" --tag="config"

This creates the file: config/irankish.php

.env variables

IRANKISH_TERMINAL_ID=12345678
IRANKISH_ACCEPTOR_ID=87654321
IRANKISH_PASSWORD=YourSecurePassword
IRANKISH_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkq...\n-----END PUBLIC KEY-----"
IRANKISH_REVERT_URL=https://example.com/payment/callback

config/irankish.php

return [
    'terminal_id' => env('IRANKISH_TERMINAL_ID'),
    'acceptor_id' => env('IRANKISH_ACCEPTOR_ID'),
    'password'    => env('IRANKISH_PASSWORD'),
    'public_key'  => env('IRANKISH_PUBLIC_KEY'),
    'revert_url'  => env('IRANKISH_REVERT_URL'),
];

💳 Example Usage

use IranKish\Facades\IranKish;
use IranKish\Enums\TransactionType;
use IranKish\Exceptions\IranKishException;
use Illuminate\Http\Request;

class PaymentController extends Controller
{
    public function pay()
    {
        try {
            // Step 1: Request token
            $response = IranKish::requestToken(150000, TransactionType::PURCHASE, [
                'paymentId' => 'ORDER-1234',
            ]);

            // Step 2: Redirect user to payment page (auto-submit form)
            return IranKish::redirect($response['token']);

            // OR (manual redirect data)
            // $redirect = IranKish::redirectData($response['token']);
            // return view('payments.redirect', compact('redirect'));
        }
        catch (IranKishException $e) {
            return back()->withErrors($e->getMessage());
        }
    }

    public function callback(Request $request)
    {
        try {
            // Step 3: Confirm transaction
            $confirmation = IranKish::confirm(
                $request->input('tokenIdentity'),
                $request->input('retrievalReferenceNumber'),
                $request->input('systemTraceAuditNumber')
            );

            return response()->json(['status' => 'success', 'data' => $confirmation]);
        }
        catch (IranKishException $e) {
            return response()->json(['status' => 'failed', 'message' => $e->getMessage()]);
        }
    }
}

📘 Methods Reference

Method Description
requestToken(int $amount, ?TransactionType $type = null, array $options = []) Create a payment token using the /tokenization/make endpoint.
requestSpecialToken(int $amount, ?TransactionType $type = null, array $options = []) Same as requestToken but for special merchants (e.g., AsanShpWPP, IsacoWPP).
redirect(string $token) Automatically renders a POST form and redirects the payer to IranKish payment page.
redirectData(string $token) Returns redirection data array for manual handling or SPA redirects.
confirm(string $token, string $rrn, string $stan) Confirms the transaction after return from payment page.
reverse(string $token, string $rrn, string $stan) Reverses a previously successful transaction (before settlement).
inquiry(array $criteria) Checks transaction status by RRN, tokenIdentity, or requestId.

🧠 Transaction Types

Enum Meaning
Purchase Standard purchase
Bill Bill payment
AsanShpWPP AsanShp wallet
SpecialBill Special bill payments
AsanShpWPPDrug AsanShp Drug Wallet
IsacoWPP ISACO Wallet Payment

🧪 Running Tests

The package includes a complete test suite using Orchestra Testbench and Http::fake().

composer install
composer test

To re-run cleanly:

rm -rf vendor
composer install && composer test

📁 All tests are located in /tests. A fake public key (tests/stubs/pubkey.pem) is included for encryption testing.

💡 Development Notes

  • Compatible with Laravel 10.x – 14.x
  • Built following PSR-4, PSR-12, and Laravel package conventions
  • Fully supports Http::fake() for integration testing
  • AES-128 + RSA encryption exactly as per IranKish API Guide V9

🤝 Contributing

Contributions are welcome! If you encounter a bug or have a feature request, please open an issue at:

👉 GitHub Issues

To contribute code:

git clone https://github.com/noorani-mm/irankish-laravel-gateway.git
composer install
phpunit

Follow PSR-12 and submit a Pull Request 💪

🧾 License

This package is open-source software licensed under the MIT License.

MIT License © Mohammad Mahdi Noorani

👥 Contributors

🌐 Also available in Persian: README-Fa.md

noorani-mm/irankish-laravel-gateway 适用场景与选型建议

noorani-mm/irankish-laravel-gateway 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 11 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「payment」 「gateway」 「laravel」 「iran」 「shaparak」 「payment-gateway」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 noorani-mm/irankish-laravel-gateway 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 noorani-mm/irankish-laravel-gateway 我们能提供哪些服务?
定制开发 / 二次开发

基于 noorani-mm/irankish-laravel-gateway 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 23
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-09