PHP code example of openbuildings / emp

1. Go to this page and download the library: Download openbuildings/emp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

openbuildings / emp example snippets


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);

use OpenBuildings\Emp\Api;

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

// ...

Api::instance();

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();

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);