定制 mediumart/momo 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mediumart/momo

最新稳定版本:0.4.4

Composer 安装命令:

composer require mediumart/momo

包简介

MTN Mobile money php client

README 文档

README

Build Status

Phpstan

License

An MTN Mobile Money php client.

Requirements

PHP >=8.0

Installation

You can install via Composer. Run the following command:

composer require  mediumart/momo

Sandbox

The client env configuration default to live. If you want to practice in the sandbox environment before going live, you probably want to enable it before resolving any client instance.

use Mediumart\MobileMoney\MobileMoney;

MobileMoney::setCurrentEnvironment('sandbox');

Alternatively, you can also configure a specific service instance to run in the sandbox by providing a 'sandbox' argument upon getting the instance.

$collection =  MobileMoney::collection('sandbox');

Connect to your Momo developer Dashboard, subscribe to a product : collection, disbursement, or remittance. Go to your profile and grab the corresponding subscription key (should be primary key or secondary key). Then create a new sandbox user for your subscription key.

use Mediumart\MobileMoney\Sandbox\UsersProvisioning;

$user =  UsersProvisioning::sandboxUserFor('<your product subscription key>');

This will get you a fresh Mediumart\ModileMoney\User instance, a value object with 3 properties (all lowercase):

$id = $user->id;

$apikey = $user->apikey;

$subscriptionkey = $user->subscriptionkey;

Use them to get a new access token for the corresponding service (collection, disbursement, or remittance).

$collection = MobileMoney::collection();

$token = $collection->createAccessToken($subscriptionkey, $id, $apikey);

The same Mediumart\ModileMoney\User class can be used to store similar values in your live environment.

Usage

Mtn Mobile Money API supported services are: collection, disbursement, and remittance. Resolve services clients instances using the MobileMoney facade.

use Mediumart\MobileMoney\MobileMoney;

$collection =  MobileMoney::collection();
$disbursement =  MobileMoney::disbursement();
$remittance =  MobileMoney::remittance();

Then this is the list of methods you 'll have access to :

shared Api (collection, disbursement, and remittance)

  • bcAuthorize
  • createAccessToken
  • createOauth2Token
  • validateAccountHolderStatus
  • getAccountBalance
  • getBasicUserinfo
  • getUserInfoWithConsent
  • requestToPayDeliveryNotification

transferApi (disbursement, remittance)

  • transfer
  • getTransferStatus

collection

  • requestToPay
  • requestToPayTransactionStatus
  • requestToWithdrawV1
  • requestToWithdrawV2
  • requestToWithdrawV1TransactionStatus
  • cancelInvoice
  • createInvoice
  • getInvoiceStatus
  • createPayments
  • getPaymentStatus
  • preApproval
  • getPreApprovalStatus

disbursement

  • depositV1
  • depositV2
  • getDepositStatus
  • refundV1
  • refundV2
  • getRefundStatus

remittance

  • cashTransfer
  • getCashTransferStatus

For now, to know which parameters are required for each method, please look at the code . A complete API docs may be released soon.

License

Mediumart momo is an open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-03