uocnv/momo-payment

与momo连接的包

1.0.1 2022-01-13 02:02 UTC

This package is auto-updated.

Last update: 2022-09-13 03:41:47 UTC


README

Latest Version on Packagist Total Downloads

这是一个帮助连接到Momo服务的全支付方式的包。

安装

您可以通过composer安装此包

composer require uocnv/momo-payment

用法

  • 发布配置

    php artisan vendor:publish --provider="Uocnv\MomoPayment\MomoPaymentServiceProvider" --tag="config"
  • 您可以从以下步骤开始

    $momoPayment = new MomoPayment(config('momo-payment.environment'));
  • 创建一个捕获请求并接收带有重定向支付URL的响应

    $response = $momoPayment->createRequest(array $data);
    $paymentUrl = $response->getPayUrl();

    更多信息请参阅:配置API

  • 处理支付结果

    您可以从响应中检查签名

    $response     = $momoPayment->checkResult($request->all());
    $errorCode    = $response->getErrorCode();
    $localMessage = $response->getLocalMessage();
    $transId      = $response->getTransId();
    $responseTime = $response->getResponseTime();
    $orderId      = $response->getOrderId();
    $orderInfo    = $response->getOrderInfo();
    $amount       = $response->getAmount();

    更多信息请参阅:处理支付结果

  • 检查交易状态

    $response = $momoPayment->checkStatus($orderId, $requestId);
    $errorCode    = $response->getErrorCode();
    $localMessage = $response->getLocalMessage();
    $transId      = $response->getTransId();
    $orderId      = $response->getOrderId();
    $amount       = $response->getAmount();

    更多信息请参阅:检查交易状态

安全

如果您发现任何与安全相关的问题,请发送电子邮件至 uocnv.soict.hust@gmail.com,而不是使用问题跟踪器。

致谢

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件

Laravel Package Boilerplate

此包是使用Laravel Package Boilerplate生成的。