mossey/mpesa
Composer 安装命令:
composer require mossey/mpesa
包简介
A PHP package for Mpesa API
README 文档
README
This package has been abandoned please use https://github.com/safaricom/mpesa-php-sdk
Introduction
This package seeks to help php developers implement the various Mpesa APIs without much hustle. It is based on the REST API whose documentation is available on http://developer.safaricom.co.ke.
Installation using composer
composer require mossey/mpesa
Configuration
At your project root, create a .env file and in it set the consumer key and consumer secret as follows
consumer_key= [consumer key]
consumer_secret=[consumer secret]
For Laravel users, open the Config/App.php file and add \Mossey\Mpesa\MpesaServiceProvider::class under providers and 'Mpesa'=> \Mossey\Mpesa\MpesaServiceProvider::class under aliases.
Usage
Confirmation and validation urls
B2C Payment Request
This creates transaction between an M-Pesa short code to a phone number registered on M-Pesa.
$mpesa= new \Mossey\Mpesa\Mpesa();
$b2cTransaction=$mpesa->b2c( $ShortCode, $CommandID, $Amount, $Msisdn, $BillRefNumber );
Account Balance Request
This is used to enquire the balance on an M-Pesa BuyGoods (Till Number)
$mpesa= new \Mossey\Mpesa\Mpesa();
$balanceInquiry=$mpesa->accountBalance($CommandID, $Initiator, $SecurityCredential, $PartyA, $IdentifierType, $Remarks, $QueueTimeOutURL, $ResultURL);
Transaction Status Request This is used to check the status of transaction.
$mpesa= new \Mossey\Mpesa\Mpesa();
$trasactionStatus=$mpesa->transactionStatus($Initiator, $SecurityCredential, $CommandID, $TransactionID, $PartyA, $IdentifierType, $ResultURL, $QueueTimeOutURL, $Remarks, $Occasion);
B2B Payment Request
This is used to transfer funds between two companies.
$mpesa= new \Mossey\Mpesa\Mpesa();
$b2bTransaction=$mpesa->b2b($ShortCode, $CommandID, $Amount, $Msisdn, $BillRefNumber );
STK Push Simulation
This is used to initiate online payment on behalf of a customer.
$mpesa= new \Mossey\Mpesa\Mpesa();
$stkPushSimulation=$mpesa->STKPushSimulation($BusinessShortCode, $LipaNaMpesaPasskey, $TransactionType, $Amount, $PartyA, $PartyB, $PhoneNumber, $CallBackURL, $AccountReference, $TransactionDesc, $Remarks);
STK Push Status Query
This is used to check the status of a Lipa Na M-Pesa Online Payment.
$mpesa= new \Mossey\Mpesa\Mpesa();
$STKPushRequestStatus=$mpesa->STKPushQuery($checkoutRequestID,$businessShortCode,$password,$timestamp);
Confirmation and Validation
These are required in order to complete most of the transaction. Without these the transactions won't be complete. Therefore, register your URLS in the developer portal and soon as you're done be sure to ensure your validation URL and confirmation URL contain the following.
Validation
$mpesa= new \Mossey\Mpesa\Mpesa();
$b2bTransaction=$mpesa->validate();
Confirmation
$mpesa= new \Mossey\Mpesa\Mpesa();
$b2bTransaction=$mpesa->confirm();
mossey/mpesa 适用场景与选型建议
mossey/mpesa 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 60 次下载、GitHub Stars 达 6, 最近一次更新时间为 2017 年 10 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mossey/mpesa 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mossey/mpesa 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 60
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: mit
- 更新时间: 2017-10-15