digitickets/omnipay-global-payments 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

digitickets/omnipay-global-payments

最新稳定版本:v1.5.0

Composer 安装命令:

composer require digitickets/omnipay-global-payments

包简介

Custom OmniPay driver for Global Payments

README 文档

README

GlobalPayments driver for the Omnipay PHP payment library

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+.

This package implements only GlobalPayments support for Omnipay 2.x Off-sites, where the customer is redirected to enter payment details (aka HPP - Hosted Payment Page).

It implements the "ecommerce" version of their integration: https://developer.globalpay.com/ecommerce/payments-start

For refunds, their ecommerce API is used, via the SDK: https://github.com/globalpayments/php-sdk

For Apple Pay, please pass in a "applePayToken" to the purchase() function: https://developer.globalpay.com/ecommerce/applepay#api

Installation

This package is installed via Composer. To install, simply add it to your composer.json file:

{
    "require": {
        "digitickets/omnipay-global-payments": "^0.*"
    }
}

And run composer to update your dependencies:

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

Basic Usage

The following gateways are provided by this package:

  • GlobalPayments

For general usage instructions, please see the main Omnipay repository.

For the refund() function, please pass in a refundPassword. Also make sure you are setting originalTransactionId, transactionRef, and authCode.

This is a sample code of standard Off-site controller using the driver.

Request a payment

// Gateway setup
$gateway = $this->gatewayFactory('GlobalPayments');

// Pluigns specific parameters
gateway->setMerchantId('00000001');
$gateway->setAccount(123);
$gateway->setSharedSecret('asdqweasdzxc');

// Create or fetch your product transaction
$transaction = $this->createTransaction($request);

// Get the data ready for the payment
// Please note that even off-site gateways make use of the CreditCard object,
// because often you need to pass customer billing or shipping details through to the gateway.
$cardData = $transaction->asOmniPay;
$itemsBag = $this->requestItemsBag($request);

// Authorize request
$request = $gateway->purchase(array(
    'amount' => $transaction->amount,
    'currency' => $transaction->currency,
    'card' => $cardData,
    'returnUrl' => $this->generateCallbackUrl(
        'GlobalPayments',
        $transaction->id
    ),
    'transactionId' => $transaction->id,
    'description' => $transaction->description,
    'items' => $itemsBag,
));

// Send request
$response = $request->send();

// Process response
$this->processResponse($response);

Process payment result

// Fetch transaction details
$transaction = Transaction::findOrFail($transactionId);

// Gateway setup
$gateway = $this->gatewayFactory('GlobalPayments');

// Pluigns specific parameters
gateway->setMerchantId('00000001');
$gateway->setAccount(123);
$gateway->setSharedSecret('asdqweasdzxc');

// Get the data ready to complete the payment. Since this is typically a stateless callback
// we need to first retrieve our original product transaction details
$params = [
    "amount" => $transaction->amount,
    "currency" => $transaction->currency,
    'returnUrl' => $this->generateCallbackUrl(
        'GlobalPayments',
        $transaction->id
    ),
    'transactionId' => $transaction->id,
    'transactionReference' => $transaction->ref,
];

// Complete purchase request
$request = $gateway->completePurchase($params);

// Send request
$response = $request->send();

// Process response
$this->processResponse($response);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-12-27