2017 © Pedro Peláez
 

library omnipay-eway

eWay driver for the Omnipay payment processing library

image

tez/omnipay-eway

eWay driver for the Omnipay payment processing library

  • Sunday, August 16, 2015
  • by MihaiP
  • Repository
  • 2 Watchers
  • 0 Stars
  • 60 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Omnipay: eWay31

eWay driver for the Omnipay PHP payment processing library, (*1)

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements eWay support for Omnipay., (*2)

Installation

Omnipay is installed via Composer. To install, simply add it to your composer.json file:, (*3)

{
    "require": {
        "tez/omnipay-eway": "~2.0"
    }
}

And run composer to update your dependencies:, (*4)

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

Basic Usage

The following gateways are provided by this package:, (*5)

  • Eway_Rapid31

For general usage instructions, please see the main Omnipay repository., (*6)

Examples

use Omnipay\Omnipay;

// Create the gateway object and set its parameters
$gateway = Omnipay::create('Eway31_Rapid');
$gateway->setTestMode(true);
$gateway->setApiKey(\Yii::$app->params['eway']['key']);
$gateway->setPassword(\Yii::$app->params['eway']['password']);

// Create a CreditCard object which we intend to validate
// via the gateway
$card = new CreditCard([
    'firstName' => 'Bobby',
    'lastName' => 'Tables',
    'number' => '4444333322221111',
    'cvv' => '123',
    'expiryMonth' => 12,
    'expiryYear' => '2017',
    'email' => 'testEway@biti.ro',
]);

// Use the gateway createCard method to determine if creating
// the card in the eWay gateway is successful.
$response = $gateway->createCard(['card' => $card])->send();
if ($response->isSuccessful()) {
    $tokenCustomerID = $response->getTokenCustomerID();
    echo "We have a token ID<br>";
    // payment was successful: update database
} elseif ($response->isRedirect()) {
    // redirect to offsite payment gateway
    $response->redirect();
    die('error');
} else {
    // payment failed: display message to customer
    print_r($response->getCode());
    print_r($response);
    die('payment failed');
}

// if we got a tokenCustomerId then we can use it for further transactions.
if(! empty($tokenCustomerID)) {

    // Make a second credit card object.
    $card2 = new CreditCard([
        'firstName' => 'Mi',
        'lastName' => 'Pe',
        'number' => '4444333322221111',
        'cvv' => '123',
        'expiryMonth' => 12,
        'expiryYear' => '2016',
        'email' => 'testEway@biti.ro',
    ]);

    // Update the card on the token.
    echo "UPDATE<br>";
    $response = $gateway->updateCard(['cardReference' => $tokenCustomerID, 'card' => $card2])->send();
    print_r($response->getCode());

    // Put through a purchase transaction with the updated card.
    echo "PURCHASE<br>";
    $response = $gateway->purchase(['amount' => '10.00', 'cardReference' => $tokenCustomerID, 'transactonId' => 'Invoice1', 'description' => 'Invoice1 billed', 'currency' => 'AUD'])->send();
    //print_r($response);
    print_r($response->getCode());

    // Make a third credit card object.
    $card3 = new CreditCard([
        'firstName' => 'Mi',
        'lastName' => 'Pe',
        //'cvv' => '123',
    ]);

    // Put through a purchase transaction with the third card.
    echo "PURCHASE<br>";
    $response = $gateway->purchase(['amount' => '10.00', 'cardReference' => $tokenCustomerID, 'transactonId' => 'Invoice1', 'description' => 'Invoice1 billed', 'currency' => 'AUD', 'card' => $card3])->send();
    //print_r($response);
    print_r($response->getCode());
}

The Versions

16/08 2015

dev-master

9999999-dev https://github.com/Mihai-P/tez-omnipay-eway

eWay driver for the Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

payment pay gateway merchant omnipay eway