djade007/omnipay-interswitch

Interswitch driver for the Omnipay payment processing library

dev-master / 2.0.x-dev 2016-10-22 20:16 UTC

This package is auto-updated.

Last update: 2024-12-08 01:04:00 UTC


README

Interswitch driver for the Omnipay payment processing library

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

Installation

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

{
    "require": {
        "djade007/omnipay-interswitch": "dev-master"
    }
}

And run composer to update your dependencies:

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

Basic Usage

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

$gateway = Omnipay::create('Interswitch');

$gateway->initialize([
    'macKey' => 'D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F',
    'productId' => 6205,
    'payItemId' => 101,
    'currency' => 'NGN',
]);


$transaction = $gateway->purchase([
    'returnUrl' => '{URL}',
    'amount' => 100000,
    'transactionId' => {RANDOM_DIGITS}
]);

$response = $transaction->send();

if ($response->isSuccessful()) {
    echo('success');
} elseif ($response->isRedirect()) {
    return $response->redirect(); // this will automatically forward the customer to interswitch
} else {
    echo('fail');
}

On Redirect Route {URL}

$gateway = Omnipay::create('Interswitch');
// same initialize values 
$gateway->initialize([
    'macKey' => 'D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F',
    'productId' => 6205,
    'payItemId' => 101,
    'currency' => 'NGN'
]);

$response = $gateway->completePurchase(['txnref' => $_POST['txnref']])->send();

if ($response->isSuccessful()) {
    echo('success');
} else {
    echo "failed\n";
    echo $response->getMessage();
}

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

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.