sylapi/omnipay-payu

Omnipay支付处理库的Paylane网关

v1.0.6 2020-08-06 13:41 UTC

This package is auto-updated.

Last update: 2024-09-29 05:29:03 UTC


README

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

Omnipay 是一个不依赖框架、多网关的PHP 5.3+支付处理库。本包实现了Omnipay的Dummy支持。

安装

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

{
    "require": {
        "sylapi/payu": "~1.0"
    }
}

然后运行composer来更新您的依赖项

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

基本用法

本包提供以下网关

  • PayU

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

基本购买示例

$gateway = \Omnipay\Omnipay::create('PayU');  
$gateway->setPosId('--Merchant Pos Id--');
$gateway->setClientSecret('--Client Secret--');
$gateway->setSecondKey('--Second key--');
$gateway->setIp('--IP--');

$response = $gateway->purchase(
    [
        "amount" => "10.00",
        "currency" => "PLN",
        "description" => "My Payment",
        "transactionId" => "12345",
        "email" => "email@example.com",
        "name" => "Jan Kowalski",
        "payMethod" => "m",
        "items" => [
            [
                "name" => "Product name",
                "price" => "10.00",
                "quantity" => 1
            ]
        ],
        "returnUrl" => "https://example.org/payu-success.php",
        "cancelUrl" => "https://example.org/payu-error.php",
        "notifyUrl" => "https://example.org/payu-callback.php",
    ]
)->send();

// Process response
if ($response->isSuccessful()) {

    if ($response->isRedirect()) {
        $response->redirect();
    }
    else {
        $data = $response->getData();
    }
} 
else {
    $error = $response->getMessage();
    $code = $response->getCode();
}

基本购买成功示例

$response = $gateway->completePurchaseNotify($_POST);

if ($response->isSuccessful()) {

    $message = $response->getMessage();
    $status = $response->getStatus();
}
else {
    $error = $response->getMessage();
    $code = $response->getCode();
}

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

支持

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

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

如果您认为您已发现一个错误,请使用 GitHub问题跟踪器 报告它,或者更好的是,分叉库并提交一个pull请求。