webtoucher/omnipay-anymoney

Any.Money 驱动程序,用于 Omnipay 支付处理库

1.0.0 2020-02-11 03:45 UTC

This package is auto-updated.

Last update: 2024-09-06 10:08:31 UTC


README

Any.Money PHP 支付处理库的 Any.Money 支付处理驱动程序。

Latest Stable Version Total Downloads Daily Downloads Latest Unstable Version License

安装

安装此库的首选方式是通过 composer

运行以下命令

$ php composer.phar require webtoucher/omnipay-anymoney "*"

或者

"webtoucher/omnipay-anymoney": "*"

将以下内容添加到您的 composer.json 文件的 require 部分。

用法

本包提供了以下网关

  • Any.Money
    $gateway = \Omnipay\Omnipay::create('AnyMoney');
    $gateway->setMerchantId('[MERCHANT_ID]');
    $gateway->setPrivateKey('[PRIVATE_KEY]');
    $this->gateway->setLogger(function ($message, $level = 'info') {
        // Your log handler
    });

第一步是准备数据和重定向到 Any.Money。

    $request = $gateway->purchase([
        'amount' => 100.5,
        'currency' => 'UAH',
        'transactionId' => '100500',
        'isMultiPay' => false,
        'payway' => 'visamc_m',
        'email' => 'user@email.com',
        'notifyUrl' => 'https://notify.url',
        'returnUrl' => 'https://return.url?order=100500',
    ]);
    $response = $request->send();
    if ($response->isRedirect()) {
        $response->redirect();
    }

存在一个通知请求处理器。

    $request = $gateway->completePurchase($_POST);
    $response = $request->send();
    $orderId = $response->getTransactionId(); // You can check this order and mark it as paid or failed.
    if ($response->isSuccessful()) {
        // Your handler
    } else {
        // Your handler
    }

在返回页面上,您可以检查支付状态。

    $request = $gateway->status([
        'transactionId' => $order,
    ]);
    $response = $request->send();
    if ($response->isSuccessful()) {
        // Your handler
        // Maybe you need to check here the status of the order on your side
    } else {
        // Your handler
    }

有关通用使用说明,请参阅主要的 Omnipay 仓库。

支持

如果您在使用 Omnipay 时遇到一般问题,我们建议在 Stack Overflow 上发表帖子。请务必添加 omnipay 标签,以便易于查找。

如果您想了解最新发布公告,讨论项目想法或提出更详细的问题,还有一个您可以订阅的 邮件列表

如果您认为您已经找到了一个错误,请使用 GitHub 问题跟踪器 报告。