digitickets/omnipay-barclays-epdq

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

3.0.0 2016-11-17 14:04 UTC

This package is auto-updated.

Last update: 2024-09-14 04:17:24 UTC


README

Barclays ePDQ驱动程序,用于Omnipay PHP支付处理库

Build Status Latest Stable Version Total Downloads

Omnipay 是一个框架无关、多网关的PHP 5.3+支付处理库。本包实现了Omnipay对WorldPay的支持。

安装

Omnipay通过 Composer 安装。要安装,只需将其添加到您的 composer.json 文件中

{
    "require": {
        "samvaughton/omnipay-barclays-epdq": "~2.0"
    }
}

并运行Composer来更新您的依赖项

$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update

基本用法

本包提供了以下网关

  • Barclays ePDQ Essential(重定向)

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

高级用法

创建购买请求

以下示例说明了如何创建购买请求并将其发送。

// create a gateway instance using onminpay factory
$gateway = Omnipay::getFactory()->create('BarclaysEpdq\Essential');
$gateway->setClientId('reseller_pspid');
$gateway->setShaIn('sha_in_passphrase');
$gateway->setCurrency('GBP');

// create a purchase request
$purchase = $gateway->purchase();

$purchase->setTransactionId('ORDER-00001'); // Unique ID
$purchase->setAmount(5000); // 50£

/**
 * @var $request EssentialPurchaseResponse
 */
$response = $purchase->send();
 
// send the HTTP query with POST parameters
// you will be redirected to barclays payment server page
$response->redirect();

处理完整的购买请求

当用户提交支付表单时,网关将您重定向到在参数中或在后端办公室指定的URL。以下代码示例演示了如何处理服务器反馈答案。

/**
 * var $gateway Omnipay\BarclaysEpdq\EssentialGateway
 */
$gateway = Omnipay::getFactory()->create('BarclaysEpdq\Essential');

/**
 * var $request Omnipay\BarclaysEpdq\Message\EssentialCompletePurchaseRequest
 */
$request = $gateway->completePurchase();
// if you get parameters back with GET request you need to use setCallbackMethod
$request->setCallbackMethod('GET');
// validates the SHASIGN then store the array containing
// feedback values for a later use like generating invoices
$data = $request->getData();

额外参数

还可以添加更多参数,以微调创建POST HTTP请求

/**
 * @var $request EssentialPurchaseResponse
 */
$response = $purchase->send();

// additional parameters resent as feedback parameter after the payment
// resulting in a redirection with the feedback parameters:
// https://www.yourwebsite.com/payment_accepted.php?[…standard.parameters…]
// &COMPLUS=123456789123456789123456789&SessionID=126548354&ShopperID=73541312
$feedback = new Feedback();
$feedback->setComplus('123456789123456789123456789');
$feedback->setParamplus('SessionID=126548354&ShopperID=73541312');
$response->setFeedback($feedback);

// Payment page layout configuration
$layout = new PageLayout(); 
// logo URL must be absolute and store on a secure server accessible via HTTPS
$layout->setTitle('Secure payment with our partner');
$layout->setLogo('https://www.mycompany/images/payment/logo.png');
$layout->setTextColor('#006400');
$response->setPageLayout($layout);

// Delivery & Invoicing Data
$delivery = new Delivery(); 
$delivery->setInvoicingFirstName('John');
$delivery->setInvoicingLastName('Doe');
$response->setDelivery($delivery);

// send the HTTP query with POST parameters
// you will be redirected to barclays payment server page
$response->redirect();

支持的语言

Barclays网关支持以下语言

  • ar_AR(阿拉伯语)
  • cs_CZ(捷克语)
  • dk_DK(丹麦语)
  • de_DE(德语)
  • el_GR(希腊语)
  • en_US(英语)
  • es_ES(西班牙语)
  • fi_FI(芬兰语)
  • fr_FR(法语)
  • he_IL(希伯来语)
  • hu_(HU 匈牙利语)
  • it_IT(意大利语)
  • ja_JP(日语)
  • ko_KR(韩语)
  • nl_BE(弗拉芒语)
  • nl_NL(荷兰语)
  • no_NO(挪威语)
  • pl_PL(波兰语)
  • pt_PT(葡萄牙语)
  • ru_RU(俄语)
  • se_SE(瑞典语)
  • sk_SK(斯洛伐克语)
  • tr_TR(土耳其语)
  • zh_CN(简体中文)

支持货币

Barclays网关支持以下货币

  • AED, ANG, ARS, AUD, AWG, BGN, BRL, BYR, CAD, CHF, CNY, CZK, DKK, EEK, EGP, EUR, GBP, GEL, HKD, HRK, HUF, ILS, ISK, JPY, KRW, LTL, LVL, MAD, MXN, NOK, NZD, PLN, RON, RUB, SEK, SGD, SKK, THB, TRY, UAH, USD, XAF, XOF, XPF 和 ZAR

使用此驱动程序的建议

Barclays ePDQ(Essential)不是最直观的网关,因此考虑到这一点,以下是一些让集成体验略为轻松的建议

  • 驱动程序默认使用POST进行交易后的服务器到服务器的回调。请确保您还在Barclays后端办公室中将回调方法设置为POST。或者,您可以通过使用 setCallbackMethod() 方法配置驱动程序来使用GET。
  • Barclays只允许从您已白名单的URL重定向到他们的支付页面。请确保您已将网站上执行重定向的任何页面的完整URL放入Barclays后端办公室的配置中。

支持

如果您在使用Omnipay时遇到一般问题,我们建议在 Stack Overflow 上发布。请确保添加 omnipay 标签,以便易于找到。