superbrave/omnipay-icepay-payments

Omnipay支付处理库的Icepay Payments支持(不包括Afterpay)。

1.5.0 2022-01-03 13:23 UTC

README

Build Status Code Coverage Scrutinizer Code Quality Software License

简介

Omnipay 是一个适用于PHP 7.2.9+的多网关支付处理库,不依赖于任何框架。本包实现了Omnipay的Icepay Payments支持,并支持ICEX2.0。因此,你需要一个 SecretKey 和一个 ContractProfileId(也称为 UserId)。

请注意,此实现目前尚不支持授权-捕获(适用于Afterpay)。

安装

要安装,只需将其添加到您的 composer.json 文件中

$ composer require superbrave/omnipay-icepay-payments

初始化

首先,创建Omnipay网关

$gateway = Omnipay\Omnipay::create('\Omnipay\IcepayPayments\Gateway');
// or
$gateway = new \Omnipay\IcepayPayments\Gateway(/* $httpClient, $httpRequest */);

然后,使用正确的凭据初始化它

$gateway->initialize([
    'secretKey' => $secretKey, // The given secret key.
    'contractProfileId' => $contractProfileId, // The given contract profile id or user id.
    'testMode' => false // Optional, default: true
]);
// or
$gateway->setSecretKey($secretKey);
$gateway->setContractProfileId($contractProfileId);

使用方法

有关一般使用说明,请参阅主要的 Omnipay 存储库。

一般流程

  1. 创建交易.
  2. 检查 交易状态
  3. 如果需要,执行一次或多次 退款 操作。

交易

要创建新的订单,请使用 transaction 方法

$data = [
    'Contract' => [
        'ContractProfileId' => '85cf0581-36e2-45c7-8d8c-a24c6f52902c',
        'AmountInCents' => 1337,
        'CurrencyCode' => 'EUR',
        'Reference' => '829c7998-6497-402c-a049-51801ba33662',
    ],
    'Postback' => [
        'UrlCompleted' => 'https://www.superbrave.nl/return-url',
        'UrlError' => 'https://www.superbrave.nl/cancel-url',
        'UrlsNotify' => [
            'https://www.superbrave.nl/notify-url',
        ],
    ],
    'IntegratorFootprint' => [
        'IPAddress' => '127.0.0.1',
        'TimeStampUTC' => '0',
    ],
    'ConsumerFootprint' => [
        'IPAddress' => '127.0.0.1',
        'TimeStampUTC' => '0',
    ],
    'Fulfillment' => [
        'PaymentMethod' => 'IDEAL',
        'IssuerCode' => 'ABNAMRO',
        'AmountInCents' => 1337,
        'CurrencyCode' => 'EUR',
        'Consumer' => [
            'Address' => [
                'CareOf' => null,
                'City' => 'Bree duh',
                'CountryCode' => 'NL',
                'HouseNumber' => null,
                'PostalCode' => '4817 HX',
                'Street' => 'Quite 18',
            ],
            'Category' => 'Person',
        ],
        'Timestamp' => '2019-03-09T12:00:00Z',
        'LanguageCode' => 'nl',
        'CountryCode' => 'NL',
        'Reference' => '829c7998-6497-402c-a049-51801ba33662',
        'Order' => [
            'OrderNumber' => '12345AB',
            'CurrencyCode' => 'EUR',
            'TotalGrossAmountCents' => 1337,
            'TotalNetAmountCents' => 1337,
        ],
        'Description' => '829c7998-6497-402c-a049-51801ba33662',
    ],
];

$request = $gateway->authorize($data);

$response = $response->send();

API 文档

状态

$data = [
    'ContractProfileId' => '85cf0581-36e2-45c7-8d8c-a24c6f52902c',
    'AmountInCents' => 1337,
    'CurrencyCode' => 'EUR',
    'Reference' => '829c7998-6497-402c-a049-51801ba33662',
];

$request = $gateway->fetchTransaction($data);

$response = $request->send();

API 文档

退款

请注意:退款实现尚未经过测试。

$data = [
    'ContractProfileId' => '85cf0581-36e2-45c7-8d8c-a24c6f52902c',
    'AmountInCents' => 1337,
    'CurrencyCode' => 'EUR',
    'Reference' => '829c7998-6497-402c-a049-51801ba33662',
];

$request = $gateway->refund($data);

$response = $request->send();

API 文档

许可

此Omnipay网关采用MIT许可。请参阅完整的许可协议