Payments for eMerchantPay (EMP) https://www.emerchantpay.com/

Installs: 4 212

Dependents: 1

Stars: 2

Watchers: 6

Language: PHP

0.1.11 2014-10-02 09:13 UTC

README

Build Status Scrutinizer Quality Score Code Coverage Latest Stable Version

This is an api for accessing eMerchantPay services

A quick example

use OpenBuildings\Emp\Api;

$api = new Api('https://my.emerchantpay.com', CLIENT_ID, API_KEY);

$response = $api->request('/service/order/submit', array(
    'payment_type' => 'creditcard',
    'test_transaction' => 1,
));

print_r($response);

Using static instance

You usually want to have this api configured once, then used everywhere with that config. To do that, you can use the configure / instance static methods

use OpenBuildings\Emp\Api;

Api::configure('https://my.emerchantpay.com', CLIENT_ID, API_KEY);

// ...

Api::instance();

Threat matrix

To enable threat matrix security you need to use Threatmatrix class. First in the page where the form of the request is displayed (right before the api request) you'll need to have this:

use OpenBuildings\Emp\Api;

$thm = new Threatmatrix(ORG_ID, CLIENT_ID);

// Save the current Threatmatrix in the session
Session::set('thm', $thm);

// Use this somewhere in your views
echo $thm->tracking_code();

After that, to perform an api request, add thm to the api instance, like this

use OpenBuildings\Emp\Api;

$api = new Api('https://my.emerchantpay.com', CLIENT_ID, API_KEY);
$thm = Session::get('thm');

$response = $api
    ->threatmatrix($thm)
    ->request('/service/order/submit', array(
        'payment_type' => 'creditcard',
        'test_transaction' => 1,
    ));

print_r($response);

License

Copyright (c) 2012-2013, OpenBuildings Ltd. Developed by Ivan Kerin as part of clippings.com

Under BSD-3-Clause license, read LICENSE file.