batons0/yopaymentsphp
Composer 安装命令:
composer require batons0/yopaymentsphp
包简介
A PHP Library to interact with the Yo! Payments API.
README 文档
README
Yo! Payments is a revolutionary mobile payments gateway service. Yo! Payments enables businesses to receive payments from their customers via mobile money, as well as make mobile money payments to any mobile money account holder. Yo! Payments also has the capability to send mobile calling credit (“airtime”) directly to users.
Yo! Payments API PHP Library is a PHP library that can be included in your PHP project to enable seamless integration with websites and web systems.
Getting Started
Prerequisites
To use the API, you must, first of all, have a Yo! Payments Business Account. The API is not available for Personal Accounts
- Yo! Payments API Username
- Yo! Payments API Password
$yoAPI = new YoAPI($username, $password);
Installing
Yo! Payments API PHP Library is available via Composer/Packagist (using semantic versioning), so just add this line to your composer.json file
"batons0/yopaymentsphp": "^1.0"
or
composer require batons0/yopaymentsphp
Then inside your PHP script, add the line
require 'vendor/autoload.php';
And voila! The Yo! Payments PHP API is now available for use.
Alternatively, copy the contents of the YoPaymentsPHP folder into one of the include_path directories specified in your PHP configuration.
If you don't use git, click the 'zip' button at the top of the page in GitHub.
Minimal Installation
While installing the entire package manually or with composer is simple, convenient and reliable, you may want to include only vital files in your project. At the very least you'll need YoAPI.php. If you are doing Instant Payment Notifications, then you'll also require Yo_Uganda_Public_Certificate.crt.
You can then load the library by just require '/path/to/YoAPI.php'; and everything should work.
A Simple Example
Start the Mobile Money User to Prompt for PIN to transfer funds
$yoAPI = new YoAPI($username, $password);
$yoAPI->set_nonblocking("TRUE");
$response = $yoAPI->ac_deposit_funds('256770000000', 10000, 'Reason for transfer of funds');
if($response['Status']=='OK'){
// Transaction was successful and funds were deposited onto your account
echo "Transaction Reference = ".$response['TransactionReference'];
}
Receive payment notification when payment completed.
$yoAPI = new YoAPI($username, $password);
if(isset($_POST)){
$response = $yoAPI->receive_payment_notification();
if($response['is_verified']){
// Notification is from Yo! Uganda Limited
echo "Payment from ".$response['msisdn']." on ".$response['date_time']." for ".$response['narrative']." with an amount of ".$response['amount'].". Mobile Network Reference = ".$response['network_ref']." and external reference of ".$response['external_ref'];
}
}
Receive notification when payment has failed.
$yoAPI = new YoAPI($username, $password);
if(isset($_POST)){
$response = $yoAPI->receive_payment_failure_notification();
if($response['is_verified']){
// Notification is from Yo! Uganda Limited
echo "Payment on ".$response['transaction_init_date']." with a FAILED transaction status ".$response['failed_transaction_reference']." closed.";
}
}
You'll find plenty more to play with in the examples folder.
That's it! You should now be ready to use YoAPI
Built With
- PHP - PHP Programming Language
Authors
- Aziz Kirumira - Initial work - Yo (U) Ltd
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- Gerald Begumisa
- Grace Kyeyune
- Joseph Tabajjwa
batons0/yopaymentsphp 适用场景与选型建议
batons0/yopaymentsphp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.91k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 03 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「package」 「composer」 「mobile money」 「YoPayments」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 batons0/yopaymentsphp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 batons0/yopaymentsphp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 batons0/yopaymentsphp 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Beyonic PHP Library
The skeleton application for NativePHP for Mobile.
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
PHP SDK for Mobile Message SMS API
统计信息
- 总下载量: 8.91k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-17