adnane-ka/omnipay-sepay
Composer 安装命令:
composer require adnane-ka/omnipay-sepay
包简介
Sepay gateway for Omnipay payment processing library
README 文档
README
Sepay payments gateway for Omnipay payment processing library
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Tap support for Omnipay.
Installation
composer require adnane-ka/omnipay-sepay
Basic Usage
The following gateways are provided by this package:
- Sepay
This package ineteracts with Sepay's API.
For general usage instructions, please see the main Omnipay repository.
Flow
- Configure gateway.
- Create a QR image for the operation.
- Display the QR image for the end-user in a on-site checkout page.
- Once the operation is accomplished, a webhook should be fired.
- Receive data from webhook.
- Complete purchase by comparing / proccessing the received data.
Example usage
Configuration
use Omnipay\Omnipay; $gateway = Omnipay::create('Sepay'); $gateway->setApiKey('YOUR_API_KEY'); $gateway->setBankAccountNumber('YOUR_BANK_ACCOUNT_NUMBER'); $gateway->setBankName('YOUR_BANK_NAME');
Creating a Purchase
$response = $gateway->purchase([ 'amount' => 100000, // the amount in VND 'checkoutUrl' => 'http://localhost:8000/checkout.php', // the page where the QR image is displayed 'returnUrl' => 'http://localhost:8000/complete.php', // the URL to return to after the operation is fully proccessed 'transactionId' => uniqid() // A unique identifier for the operation ])->send(); if ($response->isRedirect()) { // The QR code is generated successfully and you're ready to be redirected to checkout $response->redirect(); } else { // An error occured echo $response->getMessage(); }
Checkout
<!-- The return URL is going be injected as encoded URL `completeUrl` --> <form action="<?php echo urldecode($_GET['completeUrl']); ?>" method="post" style="display: flex; flex-direction: column; width:30%;"> <!-- Display the QR image for the end-user --> <img src='<?php echo urldecode($_GET['qrSrc']); ?>'> <!-- The transaction ID is received as a query param --> <input type="hidden" name="transactionId" value="<?php echo $_GET['transactionId']; ?>"> <button type="submit">I've Paid, Complete My Order.</button> </form>
Completing Purchase
When users submit the checkout form after they pay using the displayed QR image, they'll be redirected to returnUrl where you'll be proccessing the payment:
$response = $gateway->completePurchase([ 'transactionId' => 'FGJAKANMCHK', // This should be retrieved from request redirect 'amount' => 100000, // Locate this from your system 'webhookResponse' => /*This should be located from the webhook*/ json_decode('{ "id": 92704, "gateway":"Vietcombank", "transactionDate":"2024-07-25 14:02:37", "accountNumber":"0010000000355", "code":null, "content":"chuyen tien mua iphone", "transferType":"in", "transferAmount":100000, "accumulated":19077000, "subAccount":null, "referenceCode":"MBVCB.3278907687", "description":"FGJAKANMCHK" }', true) ])->send(); if($response->isSuccessful()){ // Payment was successful and charge was captured // $response->getData() // $response->getTransactionReference() // payment reference }else{ // Charge was not captured and payment failed // $response->getData() }
Support
If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.
If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.
If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.
adnane-ka/omnipay-sepay 适用场景与选型建议
adnane-ka/omnipay-sepay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 46 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 09 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 adnane-ka/omnipay-sepay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 adnane-ka/omnipay-sepay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 46
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-06