apanicker/omnipay-municipay

MuniciPAY 2.0 驱动程序,用于 Omnipay 支付处理库

v1.0.0 2021-02-28 12:16 UTC

This package is auto-updated.

Last update: 2024-09-28 20:25:28 UTC


README

Omnipay 支付处理库的 MuniciPAY 驱动程序

Omnipay 是一个不依赖于框架、支持多网关的 PHP 5.3+ 支付处理库。此包实现了 Omnipay 对 MuniciPAY 2.0 的支持。

安装

Omnipay 通过 Composer 安装。要安装,只需使用 Composer 需求 league/omnipayapanicker/omnipay-municipay

composer require league/omnipay apanicker/omnipay-municipay

基本用法

此包提供以下网关:

  • Municipay

为了使用此驱动程序,您需要从 MuniciPAY 获取测试 siteIdurlKeyprodId 列表。如果想要在沙盒模式下运行驱动程序,可以将 testMode 参数设置为 true

use Omnipay\Omnipay;

$gateway = Omnipay::create('Municipay');

$gateway->initialize([
    'siteId' => 'xxxxxxxxxx',
    'urlKey' => 'xxxxxxxxxxxxxxxxxxxxxxxxx'
]);

$response = $gateway->purchase([
    'transactionId' => 1234,
    'redirectUrl' => 'https://example.com/callback/1234',
    'listItems' => [
        [
            "prodId" => "xxxxxxxxxxxxxxxxxxxxxxxxxx",
            "amount" => "100",
            "refNum" => "XXXXXXX"
        ],
        [
            "prodId" => "xxxxxxxxxxxxxxxxxxxxxxxxxx",
            "amount" => "80.00",
            "refNum" => "XXXXXXX"
        ]
    ]
])->send();

if ($response->isRedirect()) {
    $response->redirect();
}

有关一般用法说明,请参阅主要的 Omnipay 仓库。

支持

如果您认为发现了错误,请使用 GitHub 问题跟踪器 报告,或者更好的是,分支库并提交拉取请求。