chemlabs/omnipay-invoice

Invoice driver for the Omnipay payment processing library

1.1 2019-09-18 18:54 UTC

This package is not auto-updated.

Last update: 2024-11-08 19:13:54 UTC


README

Generate invoice numbers via the transaction call as a driver for the Omnipay PHP payment processing library

Latest Stable Version Total Downloads

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

Installation

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

{
    "require": {
        "seymourlabs/omnipay-invoice": "~1.0"
    }
}

And run composer to update your dependencies:

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

Basic Usage

// Create a gateway for the Invoice Gateway
// (routes to GatewayFactory::create)
$gateway = \Omnipay\Omnipay::create('Invoice');

// Initialise the gateway
$gateway->initialize([
    'testMode' => true, // Test mode prepends "TEST:" into the invoice number
]);


// Do an authorize transaction on the gateway
$transaction = $gateway->authorize([
    'amount'                   => '10.00',
    'currency'                 => 'GBP',
]);

// optional prefix assignment
$transaction->setPrefix('ABC');

$response = $transaction->send();
if ($response->isSuccessful()) {
    echo "Authorize transaction was successful!\n";
    $sale_id = $response->getTransactionReference();
    echo "Transaction reference = " . $sale_id . "\n";
}