承接 oytunyuksel/omnipay-iyzico 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

oytunyuksel/omnipay-iyzico

Composer 安装命令:

composer require oytunyuksel/omnipay-iyzico

包简介

Iyzico gateway for Omnipay payment processing library

README 文档

README

Build Status Total Downloads Latest Stable Version License

Iyzico gateway for Omnipay V3 payment processing library

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 7.3+. This package implements Iyzico Online Payment Gateway support for Omnipay.

Iyzico API documentation

Requirement

  • PHP >= 7.3.x,
  • Omnipay V.3 repository,
  • PHPUnit to run tests

Autoload

You have to install omnipay V.3

composer require league/omnipay:^3

Then you have to install omnipay-payu package:

composer require alegra/omnipay-iyzico

payment-iyzico follows the PSR-4 convention names for its classes, which means you can easily integrate payment-iyzico classes loading in your own autoloader.

Basic Usage

  • You can use /examples folder to execute examples. This folder is exists here only to show you examples, it is not for production usage.
  • First in /examples folder:
composer install

Purchase Example

  • You can check purchase.php file in /examples folder.
  • force3ds parameter is included in the parameters. It shows the status of card. If you test direct purchase, you should send 0 value. It's type is string. If you don't send this force3ds parameter, system check status of card. System uses iyzico-installmentInfo function.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\Iyzico\Gateway;
use Examples\Helper;

$gateway = new Gateway();
$helper = new Helper();

try {
    $params = $helper->getPurchaseParams();
    $response = $gateway->purchase($params)->send();

    $result = [
        'status' => $response->isSuccessful() ?: 0,
        'redirect' => $response->isRedirect() ?: 0,
        'message' => $response->getMessage(),
        'transactionId' => $response->getTransactionReference(),
        'requestParams' => $response->getServiceRequestParams(),
        'response' => $response->getData()
    ];

    print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
    throw new \RuntimeException($e->getMessage());
}

Purchase 3d Example

  • You can check purchase3d.php file in /examples folder.
  • force3ds parameter is included in the parameters. It shows the status of card. If you test purchase 3d, you should send 1 value. It's type is string. If you don't send this force3ds parameter, system check status of card. System uses iyzico-installmentInfo function.
  • Redirect data will come to your return url. You should give returnUrl in purchase3d request.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\Iyzico\Gateway;
use Examples\Helper;

$gateway = new Gateway();
$helper = new Helper();

try {
    $params = $helper->getPurchase3dParams();
    $response = $gateway->purchase($params)->send();

    $result = [
        'status' => $response->isSuccessful() ?: 0,
        'redirect' => $response->isRedirect() ?: 0,
        'redirectUrl' => $response->getRedirectUrl() ?: null,
        'redirectData' => $response->getRedirectData(),
        'htmlData' => $response->getThreeDHtmlContent(),
        'message' => $response->getMessage(),
        'transactionId' => $response->getTransactionReference(),
        'requestParams' => $response->getServiceRequestParams(),
        'response' => $response->getData()
    ];

    print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
    throw new \RuntimeException($e->getMessage());
}

Complete Purchase Example

  • You can check completePurchase.php file in /examples folder.
  • Request parameters are created from the data you receive as a result of the 3d payment request.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\Iyzico\Gateway;
use Examples\Helper;

$gateway = new Gateway();
$helper = new Helper();

try {
    $params = $helper->getCompletePurchaseParams();
    $response = $gateway->completePurchase($params)->send();

    $result = [
        'status' => $response->isSuccessful() ?: 0,
        'message' => $response->getMessage(),
        'transactionId' => $response->getTransactionReference(),
        'requestParams' => $response->getServiceRequestParams(),
        'response' => $response->getData()
    ];

    print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
    throw new \RuntimeException($e->getMessage());
}

Cancel Example

  • You can check cancel.php file in /examples folder.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\Iyzico\Gateway;
use Examples\Helper;

$gateway = new Gateway();
$helper = new Helper();

try {
    $params = $helper->getCancelPurchaseParams();
    $response = $gateway->cancel($params)->send();

    $result = [
        'status' => $response->isSuccessful() ?: 0,
        'cancel' => $response->isCancelled() ?: 0,
        'message' => $response->getMessage(),
        'transactionId' => $response->getTransactionReference(),
        'requestParams' => $response->getServiceRequestParams(),
        'response' => $response->getData()
    ];

    print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
    throw new \RuntimeException($e->getMessage());
}

Refund Example

  • You can check refund.php file in /examples folder.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\Iyzico\Gateway;
use Examples\Helper;

$gateway = new Gateway();
$helper = new Helper();

try {
    $params = $helper->getRefundParams();
    $response = $gateway->refund($params)->send();

    $result = [
        'status' => $response->isSuccessful() ?: 0,
        'message' => $response->getMessage(),
        'transactionId' => $response->getTransactionReference(),
        'requestParams' => $response->getServiceRequestParams(),
        'response' => $response->getData()
    ];

    print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
    throw new \RuntimeException($e->getMessage());
}

Purchase Transaction Detail Example

  • You can check purchaseInfo.php file in /examples folder.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\Iyzico\Gateway;
use Examples\Helper;

$gateway = new Gateway();
$helper = new Helper();

try {
    $params = $helper->getPurchaseInfoParams();
    $response = $gateway->purchaseInfo($params)->send();

    $result = [
        'status' => $response->isSuccessful() ?: 0,
        'message' => $response->getMessage(),
        'transactionId' => $response->getTransactionReference(),
        'requestParams' => $response->getServiceRequestParams(),
        'response' => $response->getData()
    ];

    print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
    throw new \RuntimeException($e->getMessage());
}

Installment Detail Example

  • You can check installmentInfo.php file in /examples folder.
<?php

$loader = require __DIR__ . '/vendor/autoload.php';
$loader->addPsr4('Examples\\', __DIR__);

use Omnipay\Iyzico\Gateway;
use Examples\Helper;

$gateway = new Gateway();
$helper = new Helper();

try {
    $params = $helper->getInstallmentInfoParams();
    $response = $gateway->installmentInfo($params)->send();

    $result = [
        'status' => $response->isSuccessful() ?: 0,
        'message' => $response->getMessage(),
        'transactionId' => $response->getTransactionReference(),
        'requestParams' => $response->getServiceRequestParams(),
        'response' => $response->getData()
    ];

    print("<pre>" . print_r($result, true) . "</pre>");
} catch (Exception $e) {
    throw new \RuntimeException($e->getMessage());
}

requestParams:

System send request to Iyzico api. It shows request information.

Licensing

GNU General Public Licence v3.0

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固