JamesNuttall/omnipay-barclays-dl

Omnipay支付处理库的Barclays ePDQ Direct Link驱动程序。

2.0.0 2018-11-08 11:09 UTC

This package is auto-updated.

Last update: 2024-09-17 01:17:16 UTC


README

Omnipay: Barclays ePDQ DirectLink

Barclays ePDQ DirectLink为Omnipay PHP支付处理库提供的驱动程序

Build Status Latest Stable Version Total Downloads License

Omnipay 是一个适用于PHP 5的多网关支付处理库,与框架无关。

此包实现了 Barclays ePDQ Direct Link 支持,并支持Omnipay 2.x上的PHP 5.5+。要使用Omnipay 3.x,请参阅 master分支

注意

此网关当前仅支持以下内容

  • 采购请求
  • 采购响应

路线图

以下是我在未来计划工作的功能/变更

  • 清理分支
  • 退款请求
  • 维护请求
  • 预先授权请求(非常确定在当前包的状态下不可行?)
  • 可能改进响应解析/报告
  • 订单查询请求

安装

使用composer,可以像这样安装master分支

composer require league/omnipay jamesnuttall/omnipay-barclays-dl:~2.0

基本用法

此包提供了以下网关

  • Barclays ePDQ DirectLink

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

基本采购示例

// Gateway initialization
$gateway = \Omnipay\Omnipay::create('BarclaysEpdqDl');
$gateway->setClientId('xxxxxx');
$gateway->setUserId('xxxx');
$gateway->setPassword('xxxxxxx');
$gateway->setShaIn('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
$gateway->setTestMode(true);

// Card data
$card = [
    'number' => 'xxxxxxxxxxxxxxxx',
    'expiryMonth' => 'xx',
    'expiryYear' => 'xxxx',
    'cvv' => 'xxx'
];

// Try to send purchase request
try {
    $response = $gateway->purchase(
        [
            'transactionId' => 'xxxxxxxxxx',
            'amount' => '25.00',
            'currency' => 'GBP',
            'card' => $card
        ]
    )->send();

    if ($response->isSuccessful()) {
        // Payment successful
        print($response->getTransactionReference());

    } else {
        // Payment failed
        print($response->getMessage());
    }
} catch (\Exception $e) {
    // Internal error, log exception and display a generic message to the customer
    exit("Error processing your payment. Please try again later.");
}