kipolaboratory/kipo-kpg
Composer 安装命令:
composer require kipolaboratory/kipo-kpg
包简介
Kipopay payment gateway library OOP (PHP)
README 文档
README
PHP Kipo KPG Library make it easy to stablish payment with kipo gateway.
- Installation
- Quick Start and Examples
- Properties
- HTML Form to transfer user to KPG
- Error code and messages
Installation
To install PHP Kipo KPG Library, simply:
$ composer require kipolaboratory/kipo-kpg
For latest commit version:
$ composer require kipolaboratory/kipo-kpg @dev
Requirements
PHP Kipo KPG Library works with PHP 5.6, 7.0, 7.1, 7.2.
Quick Start and Examples
Initial Kipo KPG and request shoping key from kipo server.
use kipolaboratory\KipoPay\KipoKPG; /** * Initial Kipo Library and craete object from that class * Merchant key is merchant phone number */ $kipo = new KipoKPG(['merchant_key' => '09*********']); /** * Replace "YOUR CALLBACK URL" and "AMOUNT" with what you want * KPGInitiate return ARRAY for result * Successful - ['status' => true, 'shopping_key' => SHOPING_KEY] * Failed - ['status' => false, 'message' => ERROR_MESAGE, 'code' => ERROR_CODE] */ $kpg_initiate = $kipo->KPGInitiate(AMOUNT, 'YOUR CALLBACK URL'); if ($kpg_initiate['status']) { /** * Store $kpg_initiate['shopping_key'] to session to verfiy * payment after user came back from gateway * * Call renderForm function to render a html form and send * user to Kipo KPG Gateway (you can create this form manually * where you want - form example is at the end of Quick Start */ $kipo->renderForm($kpg_initiate['shopping_key']); } else { /** * Show error to user * * You can call getErrorMessage and send error code to that * and get error message * $kipo->getErrorMessage(ERROR_CODE) */ }
Verify payment after user return back to CALLBACK URL
/** * Replace "SHOPPING_KEY" with your SHOPPING_KEY that you taken from * Initiate function * * KPGInquery return ARRAY for result * Successful - ['status' => true, 'referent_code' => REFERENT_CODE, 'amount' => PAYMENT_AMOUNT] * Failed - ['status' => false, 'message' => ERROR_MESAGE, 'code' => ERROR_CODE] */ $kpg_inquery = $kipo->KPGInquery(SHOPPING_KEY);
// Get shopping key after KPGInitiate called $curl->getShoppingKey();
// Get referent code after KPGInquery called $curl->getReferentCode();
Properties
// URL of Kipo KPG - https://webgate.kipopay.com/ // Shopping key must post to this url with SK name $kipo->kipo_webgate_url;
HTML Form to transfer user to KPG
<form id="kipopay-gateway" method="post" action="KIPO_WEBGATE_URL" style="display: none;"> <input type="hidden" id="sk" name="sk" value="SHOPING_KEY"/> </form> <script language="javascript">document.forms['kipopay-gateway'].submit();</script>
Error code and messages
- -1: There is a problem with request parameters, please check them out (initial payment)
- -2: There is a problem with parse requested data (please request again later)
- -3: Connection error, API can't connect to KIPO server
- -4: There is a problem with request parameters, please check them out (verify payment)
- -5: Payment canceled by user or there is a problem
- -6: Invalid Merchant key (Merchant mobile number)
- -7: Minimum payment must be atleast 1.000 Rials
- -8: Maximum payment must be 100.000.000 Rials
- -9: Invalid payment token (shoping key) format
kipolaboratory/kipo-kpg 适用场景与选型建议
kipolaboratory/kipo-kpg 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 170 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 08 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「payment」 「OOP」 「gateway」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kipolaboratory/kipo-kpg 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kipolaboratory/kipo-kpg 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kipolaboratory/kipo-kpg 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A php library to bootstrap the use of Domain Driven Design valueObjects
Super simple HTTP client
Alfabank REST API integration
An object-oriented framework around common WordPress functionality to jumpstart theme and plugin development.
PDO database library
Container for design pattern Dependency Injection in PHP 7
统计信息
- 总下载量: 170
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-29