payrexx/omnipay-payrexx

此包已被废弃且不再维护。未建议替代包。

用于Omnipay支付处理库的Payrexx驱动程序

v1.1 2020-07-10 13:13 UTC

This package is auto-updated.

Last update: 2023-03-10 19:30:26 UTC


README

用于Omnipay PHP支付处理库的Payrexx驱动程序

Payrexx是一个不依赖于特定框架的、多网关支付处理库。此包实现了Omnipay对Payrexx的支持。

安装

通过Composer安装Payrexx。要安装,只需使用Composer要求league/omnipaypayrexx/omnipay

composer require league/omnipay payrexx/omnipay-payrexx

基本使用

此包提供了以下网关

  • Payrexx

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

基本购买和退款示例

require __DIR__ . '/vendor/autoload.php';

use Omnipay\Omnipay;

$gateway = Omnipay::create('Payrexx');
$gateway->setApiKey('API_KEY'); // You find the API key in your Payrexx merchant backend
$gateway->setInstance('INSTANCE'); // That's your Payrexx instance name (INSTANCE.payrexx.com)

// Let's create a Payrexx gateway
$response = $gateway->purchase([
    'amount' => '100', // CHF 100.00
    'currency' => 'CHF',
    'psp' => 36, // Payrexx Direct
    'skipResultPage' => true,
    'successRedirectUrl' => 'https://www.merchant-website.com/success',
    'failedRedirectUrl' => 'https://www.merchant-website.com/failed',
])->send();

// A Payrexx gateway is always a redirect
if ($response->isRedirect()) {
    // Redirect URL to Payrexx gateway
    var_dump($response->getRedirectUrl());
    $response->redirect();
}

// That will be the Payrexx gateway ID
var_dump($response->getTransactionReference());

// Check if Payrexx gateway has been paid
$response = $gateway->completePurchase([
    'transactionReference' => $response->getTransactionReference(),
])->send();

// If Payrexx gateway has been paid, we will get a transaction reference (Payrexx transaction ID)
if ($response->getTransactionReference()) {
    // Optional: Fetch the corresponding transaction data => $response->getData()
    $response = $gateway->fetchTransaction([
        'transactionReference' => $response->getTransactionReference(),
    ])->send();

    // Let's refund CHF 50.00 (PSP has to support refunds => Payrexx Direct supports refunds)
    $response = $gateway->refund([
        'transactionReference' => $response->getTransactionReference(), // That's the Payrexx transaction ID as well
        'amount' => 50, // CHF 50.00
    ])->send();

    if ($response->isSuccessful()) {
        echo 'Refund was successful';
    }
}

支持

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

如果您想了解发布公告,讨论项目想法或提出更详细的问题,还有一个您可以订阅的邮件列表

如果您认为您发现了一个错误,请将其报告给integration@payrexx.com,或者更好的是,分支库并提交拉取请求。