pointybeard/omnipay-nabtransact

NAB Transact XML API gateway for the Omnipay payment processing library

0.1.1 2015-09-07 04:34 UTC

This package is auto-updated.

Last update: 2024-12-05 11:36:29 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

NAB Transact API driver for the Omnipay PHP payment processing library

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements NAB Transact support for Omnipay.

IMPORTANT: This is a very early alpha release, so it's pretty rough, and is likely to be buggy. Please do not use this in production environments. If anyone wants to help me out, that would be awesome.

Installation

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

{
    "require": {
        "pointybeard/omnipay-nabtransact": "~0.1"
    }
}

And run composer to update your dependencies:

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

Basic Usage

    include(__DIR__ . '/../vendor/autoload.php');
    use Omnipay\Omnipay;
    use Omnipay\Common as OmnipayCommon;

    $g = Omnipay::create('NABTransact_Periodic');
    $g->initialize([
        'merchantID' => 'XYZ0010',
        'password' => 'abcd1234',
        'testMode' => true,
    ]);

    // Add a customer
    $request = $g->createCard(['card' => [
            'number' => '4111111111111111',
            'expiryMonth' => '02',
            'expiryYear' => '18',
            'cvv' => '123',
        ]
    ]);
    $response = $request->send();

    // Update a customer
    $request = $g->updateCard([
        'customerReference' => $response->getCustomerReference(),
        'card' => [
            'number' => '4444333322221111',
            'expiryMonth' => '03',
            'expiryYear' => '16'
        ]
    ]);
    $response = $request->send();

    // Trigger a payment
    $request = $g->purchase([
        'customerReference' => $response->getCustomerReference(),
        'transactionReference' => 'Test Trigger of CC Payment',
        'amount' => '1234',
        'currency' => 'AUD',
    ]);

    $response = $request->send();

    // Delete a customer
    $request = $g->deleteCard(['customerReference' => $response->getCustomerReference()]);
    $response = $request->send();

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

Out Of Scope

This currently supports the 'addcrn', 'editcrn', 'deletecrn' and 'trigger' actions of NAB's "Customer Management and Payment scheduling" XML API. Eventually it will support scheduling and triggering a DD payment.

It does not support the "XML API for Payments" API, however will eventually.

Support

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.