ramin-roozdar/gateway
Composer 安装命令:
composer require ramin-roozdar/gateway
包简介
A Laravel package for connecting to all Iraninan payment gateways
关键字:
README 文档
README
Iranian Payment Gateways
This library is inspired by laravel Socialite and PoolPort and larabook/gateway and ShirazSoft/Gateway
Available PSPs (Bank):
- Beh Pardakht (MELLAT)
- SADAD (MELLI)
- SEP (SAMAN)
- PEC (PARSIAN)
- Mabna (SADERAT)
- Asan Pardakht
- IranKish
Available 3rd-parties:
- Pay.ir
- JibIt
- Pardano
- ZarinPal
- NextPay
Install
Step 1:
composer require parsisolution/gateway
Step 2:
php artisan vendor:publish --provider="Parsisolution\Gateway\GatewayServiceProvider"
Step 3:
Change config/gateways.php fields to your specifications.
Usage
Step 1:
Get instance of Gateway from Gateway Facade Gateway::of('mellat')
Or create one yourself: new Mellat(app(), config('gateways.mellat')); Or
new Mellat(app(), [ 'username' => '', 'password' => '', 'terminalId' => 0000000, 'callback-url' => '/' ]);
Step2:
Then to create new payment transaction you can do like this:
try { $gateway = Gateway::of('zarinpal'); // $gateway = new Zarinpal(app(), config('gateways.zarinpal')); $gateway->callbackUrl(route('callback')); // You can change the callback // You can make it stateless. // in default mode it uses session to store and retrieve transaction id // (and other gateway specific or user provided (using $gateway->with) required parameters) // but in stateless mode it get transaction id and other required parameters from callback url // Caution: you should use same stateless value in callback too $gateway->stateless(); // Then you should create a transaction to be processed by the gateway // Amount is in `Toman` by default but you can set the currency in second argument as well. IRR (for `Riyal`) $transaction = new RequestTransaction(new Amount(12000)); // 12000 Toman $transaction->setExtra([ 'mobile' => '9122628796', // mobile of payer (for zarinpal) 'email' => 'ali@gmail.com', // email of payer (for zarinpal) ]); $transaction->setExtraField('description', 'توضیحات من'); $authorizedTransaction = $gateway->authorize($transaction); $refId = $authorizedTransaction->getReferenceId(); // شماره ارجاع بانک $transID = $authorizedTransaction->getId(); // شماره تراکنش // در اینجا // شماره تراکنش بانک را با توجه به نوع ساختار دیتابیس تان // در جداول مورد نیاز و بسته به نیاز سیستم تان // ذخیره کنید . return $gateway->redirect($authorizedTransaction); } catch (\Exception $e) { echo $e->getMessage(); }
Step3:
And in callback
try { $settledTransaction = Gateway::settle(true); // true argument for stateless $trackingCode = $settledTransaction->getTrackingCode(); $refId = $settledTransaction->getReferenceId(); $cardNumber = $settledTransaction->getCardNumber(); // تراکنش با موفقیت سمت بانک تایید گردید // در این مرحله عملیات خرید کاربر را تکمیل میکنیم } catch (\Parsisolution\Gateway\Exceptions\RetryException $e) { // تراکنش قبلا سمت بانک تاییده شده است و // کاربر احتمالا صفحه را مجددا رفرش کرده است // لذا تنها فاکتور خرید قبل را مجدد به کاربر نمایش میدهیم echo $e->getMessage() . "<br>"; } catch (\Exception $e) { // نمایش خطای بانک echo $e->getMessage(); }
ramin-roozdar/gateway 适用场景与选型建议
ramin-roozdar/gateway 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 11 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「pay」 「gateway」 「laravel」 「Bank」 「port」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ramin-roozdar/gateway 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ramin-roozdar/gateway 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ramin-roozdar/gateway 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Payyo Gateway for the Omnipay payment processing library
Библиотека для приема платежей через Альфабанк.
Some pre-defined rules for validation in Omnipay payment processing library.
BluePay gateway for the Omnipay payment processing library
支付宝接口扩展包
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-29