nekofar/omnipay-nobitex

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

v1.0.0-alpha.5 2022-05-15 06:54 UTC

README

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

Packagist Version PHP from Packagist Travis (.com) branch Codecov Packagist Twitter: nekofar

Omnipay 是一个不依赖于框架的、多网关的 PHP 支付处理库。此软件包实现了 Omnipay 的 Nobitex 支持。

安装

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

composer require league/omnipay nekofar/omnipay-nobitex

基本用法

此软件包提供以下网关

  • Nobitex

有关一般用法说明,请参阅主 Omnipay 存储库。

示例

购买

结果将重定向到网关或银行。

use Omnipay\Omnipay;

$gateway = Omnipay::create('Nobitex');
$gateway->setApiKey('xxxxxxxx');
$gateway->setReturnUrl('https://www.example.com/return');

// Send purchase request
$response = $gateway->purchase([
    'amount' => 10000,
    'description' => 'Some description'
])->send();

// Process response
if ($response->isRedirect()) {
    // Redirect to offsite payment gateway
    $response->redirect();
} else {
    // Payment failed: display message to customer
    echo $response->getMessage();
}

返回时,通常的 completePurchase 将提供交易尝试的结果。

最终结果包括以下方法来检查额外详细信息

// Send purchase complete request
$response = $gateway->completePurchase([
    'token' => $_REQUEST['token'], 
)->send();

// Process response
if ($response->isSuccessful()) {
    // Payment was successful
    print_r($response);
} else {
    // Payment failed: display message to customer
    echo $response->getMessage();
}

测试

composer test

支持

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

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

如果您认为发现了错误,请使用 GitHub 问题跟踪器 报告,或者更好的方法是分支库并提交拉取请求。