gtsvetanov/omnipay-raiffeisen

Raiffeisen Bank BG网关,用于Omnipay支付处理库

1.0.5 2023-09-19 19:12 UTC

This package is auto-updated.

Last update: 2024-09-19 21:11:28 UTC


README

Raiffeisen Bank E-commerce网关,用于Omnipay支付处理库

Omnipay 是一个不依赖于框架的、多网关支付处理库,适用于PHP。本包实现了Omnipay对Raiffeisen Bank BG的支持。

安装

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

composer require league/omnipay gtsvetanov/omnipay-raiffeisen

基本用法

购买

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

$gateway->setMerchantId($config['merchantId'])
    ->setTerminalId($config['terminalId'])
    ->setPrivateKey($config['privateKey'])
    ->setCurrency($config['currency'])
    ->setTestMode($config['testMode'])
    ->setGatewayCertificate($config['production_gateway_certificate']);

$response = $gateway->purchase(
    [
        'TotalAmount' => 100,
        'OrderID' => 'OrderID',
    ]
)->send();

// Process response
if ($response->isSuccessful()) {
    // Payment was successful
    print_r($response);
} elseif ($response->isRedirect()) {
    // Redirect to offsite payment gateway
    $response->redirect();
} else {
    // Payment failed
    echo $response->getMessage();
}

完成购买

$response = $gateway->completePurchase()->send();

print_r($response->getData());
print_r($response->isSuccessful());
print_r($response->getCode());
print_r($response->getTransactionReference());

退款

$response = $gateway->refund([
    'TotalAmount' => 100,
    'RefundAmount' => 100,
    'OrderID' => 'OrderID',
    'Rrn' => 'Rrn',
    'ApprovalCode' => 'ApprovalCode',
])->send();

print_r($response->getData());
print_r($response->isSuccessful());
print_r($response->getCode());
print_r($response->getMessage());

获取交易

$response = $gateway->fetchTransaction([
    'TotalAmount' => 100,
    'OrderID' => 'OrderID',
    'PurchaseTime' => 'PurchaseTime',
])->send();

print_r($response->getData());
print_r($response->isSuccessful());
print_r($response->isReversal());
print_r($response->getCode());
print_r($response->getMessage());
print_r($response->getTransactionReference());

接收通知

$response = $gateway->acceptNotification()->send();

print_r($response->getData());
print_r($response->isSuccessful());
print_r($response->getCode());
print_r($response->getMessage());
print_r($response->getTransactionReference());
print_r($response->getTransactionStatus());
print_r($response->getBody());

使用令牌支付

$response = $gateway->payByToken([
    'TotalAmount' => 100,
    'OrderID' => 'OrderID',
    'UPCToken' => 'UPCToken',
])->send();

print_r($response->getData());
print_r($response->isSuccessful());
print_r($response->getCode());
print_r($response->getMessage());
print_r($response->getTransactionReference());
print_r($response->getTransactionStatus());
print_r($response->getBody());