eMerchantPay driver for the Omnipay PHP payment processing library, (*1)
, (*2)
Omnipay is a framework agnostic, multi-gateway payment
processing library for PHP 5.3+. This package implements eMerchantPay support for Omnipay., (*3)
Installation
Omnipay is installed via Composer. To install, simply add it
to your composer.json
file:, (*4)
{
"require": {
"clippings/omnipay-emp": "~0.1"
}
}
And run composer to update your dependencies:, (*5)
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
Basic Usage
The following gateways are provided by this package:, (*6)
For general usage instructions, please see the main Omnipay
repository., (*7)
In order to use this gateway, you need to provide apiKey and clientId., (*8)
$gateway = Omnipay::create('eMerchantPay');
$gateway->setApiKey('abc123');
$gateway->setClientId('abc123');
You can additionally configure Threatmatrix:, (*9)
$threatmatrix = new Threatmatrix('organiazation id', 'client id');
$gateway->setThreatmatrix($threatmatrix);
For a successful purchase you need to provide transactionReference
,currency
,clientIp
,card
anditems
:, (*10)
$purchase = $gateway->purchase(array(
'currency' => 'GBP',
'transactionReference' => 'referenceID1',
'clientIp' => '95.87.212.88',
'items' => array(
array(
'name' => 10,
'price' => '5.00',
'description' => 'Product 1 Desc',
'quantity' => 2
),
array(
'name' => 12,
'price' => '5.00',
'description' => 'Shipping for Product 1',
'quantity' => 1
),
array(
'name' => 12,
'price' => '0.00',
'description' => 'Promotion',
'quantity' => 1
),
),
'card' => array(
'firstName' => 'Example',
'lastName' => 'User',
'number' => '4111111111111111',
'expiryMonth' => 7,
'expiryYear' => 2013,
'cvv' => 123,
'address1' => '123 Shipping St',
'address2' => 'Shipsville',
'city' => 'Shipstown',
'postcode' => '54321',
'state' => 'NY',
'country' => 'US',
'phone' => '(555) 987-6543',
'email' => 'john@example.com',
)
));
All of the fields above are supported, and depending on your eMerchantPay configuration - required. Items with negative prices are also supported. The name of each item must be a unique identifier. This is used for refunds later., (*11)
A full refund example:, (*12)
$refund = $gateway->refund(array(
'amount' => '200.00',
'description' => 'Faulty Product',
'transactionReference' => '51711614',
'transactionId' => '1413980404',
));
You can also do partial refunds by providing the items directly. This type of refund ignores "amount":, (*13)
$refund = $gateway->refund(array(
'items' => array(
array(
'name' => '51945994',
'price' => '10.00',
),
array(
'name' => '51946004',
'price' => '5.00',
)
),
'description' => 'Faulty Product',
'transactionReference' => '51711614',
'transactionId' => '1413980404',
));
Where item "name" is the id, given by eMerchantPay in the data of the purchase response., (*14)
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., (*15)
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., (*16)
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., (*17)
License
Copyright (c) 2014, Clippings Ltd. Developed by Ivan Kerin, (*18)
Under BSD-3-Clause license, read LICENSE file., (*19)