mediumart / momo
MTN移动货币php客户端
0.4.4
2024-01-17 12:00 UTC
Requires
- php: >=8.0
- guzzlehttp/guzzle: ^7.4
- ramsey/uuid: ^4.2
Requires (Dev)
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^9.5
README
一个MTN移动货币php客户端。
要求
PHP >=8.0
安装
您可以通过Composer进行安装。运行以下命令
composer require mediumart/momo
沙盒
客户端env
配置默认为live
。如果您想在上线前在沙盒环境中进行练习,您可能需要在解决任何客户端实例之前启用它。
use Mediumart\MobileMoney\MobileMoney; MobileMoney::setCurrentEnvironment('sandbox');
或者,您也可以通过在获取实例时提供'sandbox'
参数来配置一个特定的服务实例以在沙盒中运行。
$collection = MobileMoney::collection('sandbox');
请访问您的Momo开发者仪表板,订阅一个产品:collection
、disbursement
或remittance
。转到您的个人资料并获取相应的订阅密钥(应该是primary key
或secondary key
)。然后为您的订阅密钥创建一个新的沙盒用户。
use Mediumart\MobileMoney\Sandbox\UsersProvisioning; $user = UsersProvisioning::sandboxUserFor('<your product subscription key>');
这将为您提供一个全新的Mediumart\ModileMoney\User
实例,一个具有3个属性(全部小写)的值对象。
$id = $user->id; $apikey = $user->apikey; $subscriptionkey = $user->subscriptionkey;
使用它们来获取对应服务(collection
、disbursement
或remittance
)的新访问令牌。
$collection = MobileMoney::collection(); $token = $collection->createAccessToken($subscriptionkey, $id, $apikey);
相同的Mediumart\ModileMoney\User
类可以用于在您的live
环境中存储类似值。
用法
Mtn移动货币API支持的服务有:collection
、disbursement
和remittance
。使用MobileMoney
外观类解析服务客户端实例。
use Mediumart\MobileMoney\MobileMoney; $collection = MobileMoney::collection(); $disbursement = MobileMoney::disbursement(); $remittance = MobileMoney::remittance();
然后这是您可以访问的方法列表
共享Api(collection
、disbursement
和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
目前,要了解每个方法所需的参数,请查看代码。完整的API文档可能很快就会发布。
许可证
Mediumart momo是一个开源软件,根据MIT许可证授权。