bileto/omnipay-tatrabank

TatraBank支付处理库的网关

v0.5.0 2017-05-10 09:39 UTC

This package is auto-updated.

Last update: 2024-08-29 03:58:09 UTC


README

TatraBank的Omnipay PHP支付处理库驱动程序

Omnipay是一个不依赖于框架、多网关的PHP 5.3+支付处理库。本软件包实现了对Omnipay的TatraBank在线支付网关支持。

TatraBank不提供沙盒环境,但他们提供了这个在线测试表单

文档

CardPay (SK)

安装

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

{
    "require": {
        "bileto/omnipay-tatrabank": "~0.2"
    }
}

TL;DR

use Omnipay\Tatrabank\GatewayFactory;

$secureKey = "3132333435363738393031323334353637383930313233343536373839303132";
$gateway = GatewayFactory::createInstance($secureKey);

try {
    $merchantId = 'A1029DTmM7';
    $orderNo = '12345677';
    $returnUrl = 'http://localhost:8000/gateway-return.php';
    $description = 'Shopping at myStore.com (Lenovo ThinkPad Edge E540, Shipping with PPL)';

    $purchase = new \Omnipay\Csob\Purchase($merchantId, $orderNo, $returnUrl, $description);
    $purchase->setCart([
        new \Omnipay\Csob\CartItem("Notebook", 1, 1500000, "Lenovo ThinkPad Edge E540..."),
        new \Omnipay\Csob\CartItem("Shipping", 1, 0, "PPL"),
    ]);

    /** @var \Omnipay\Csob\Message\ProcessPaymentResponse $response */
    $response = $gateway->purchase($purchase->toArray())->send();

    // Payment init OK, redirect to the payment gateway
    echo $response->getRedirectUrl();
} catch (\Exception $e) {
    dump((string)$e);
}

#备注

还有一个第三方模拟网关列表,但没有HMAC版本。