saeidgi/blupay
Composer 安装命令:
composer require saeidgi/blupay
包简介
BluPay (SEP / pg-neo) payment gateway for Laravel
README 文档
README
About This Package
BluPay was initially developed as an internal utility for personal use in real-world projects. To facilitate adoption and reduce integration effort for other development teams, it was later refactored and published as an independent, open-source package with clear documentation.
A lightweight Laravel package for integrating SEP (Saman Electronic Payment) Internet Payment Gateway (IPG), including pg-neo behavior.
📘 Persian Documentation:
برای مطالعه راهنمای فارسی این پکیج، به فایل
README.fa.md
مراجعه کنید.
Features
- Request Token (JSON POST)
- Redirect customer to payment page (POST form or GET SendToken)
- Verify transaction
- Reverse transaction
- Supports pg-neo: reads payment URL from
X-IPG-Urlheader when provided
Requirements
- PHP >= 8.1
- Laravel 10 / 11 / 12
- guzzlehttp/guzzle ^7
Installation
composer require saeidgi/blupay php artisan vendor:publish --tag=blupay-config
Configuration
Add to .env:
BLUPAY_TERMINAL_ID=2015 BLUPAY_TIMEOUT=30
Optional endpoint overrides:
BLUPAY_TOKEN_URL=https://sep.shaparak.ir/onlinepg/onlinepg BLUPAY_PAY_URL=https://sep.shaparak.ir/OnlinePG/OnlinePG BLUPAY_SEND_URL=https://sep.shaparak.ir/OnlinePG/SendToken BLUPAY_VERIFY_URL=https://sep.shaparak.ir/verifyTxnRandomSessionkey/ipg/VerifyTransaction BLUPAY_REVERSE_URL=https://sep.shaparak.ir/verifyTxnRandomSessionkey/ipg/ReverseTransaction
Usage
1) Request Token
use BluPay; $tokenResp = BluPay::driver()->requestToken( amount: 12000, resNum: 'ORDER-123', redirectUrl: route('pay.callback'), cellNumber: '09120000000' ); if (!$tokenResp->success) { return response()->json([ 'errorCode' => $tokenResp->errorCode, 'errorDesc' => $tokenResp->errorDesc, ], 422); } $token = $tokenResp->token;
2) Redirect Customer to Payment Gateway
Option A: GET Redirect (SendToken)
return redirect()->away( BluPay::driver()->redirectUrl($token) );
Option B: POST Form Redirect (OnlinePG)
If you prefer POST redirect (HTML form), use the documented OnlinePG action endpoint.
3) Handle Callback + Verify
use BluPay; use Illuminate\Http\Request; Route::post('/pay/callback', function (Request $request) { $refNum = $request->input('RefNum'); $verify = BluPay::driver()->verify($refNum); if ($verify->success !== true) { return response()->json([ 'ok' => false, 'resultCode' => $verify->resultCode, 'resultDescription' => $verify->resultDescription, ], 400); } // IMPORTANT: Compare verified amount with your expected amount before fulfilling the order. return response()->json([ 'ok' => true, 'transactionDetail' => $verify->transactionDetail, ]); })->name('pay.callback');
4) Reverse Transaction
$reverse = BluPay::driver()->reverse($refNum); if (!$reverse->success) { // handle failed reverse }
pg-neo Support (Important)
In pg-neo, after requesting token, the gateway base URL may be returned in response headers:
- Header:
X-IPG-Url - Example:
https://neo-pg.sep.ir/transaction/init
This package exposes that header via:
$tokenResp->ipgUrlFromHeader;
License
MIT
Disclaimer
This package is an independent open-source client implementation based on publicly available technical documentation of the SEP payment gateway. It is not an official product of Saman Electronic Payment and is provided "as is" without any warranty.
saeidgi/blupay 适用场景与选型建议
saeidgi/blupay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 01 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 saeidgi/blupay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 saeidgi/blupay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-01