PHP code example of fadion / raiffeisen

1. Go to this page and download the library: Download fadion/raiffeisen 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/ */

    

fadion / raiffeisen example snippets



re_once('src/Notify.php');


h = new Fadion\Raiffeisen\Authenticate(...);
$notify = new Fadion\Raiffeisen\Notify(...);


use Fadion\Raiffeisen\Authenticate;

$merchant_id = '111';
$terminal_id = '222';
$total = 3500;

$auth = new Authenticate($merchant_id, $terminal_id, $total);
$data = $auth->generate();


$options = [
	'purchase_time' => date('ymdHis', strtotime('-1 hour')), // koha kur eshte kryer porosia
	'order_id' => '11EE5D', // ID e porosise
	'currency_id' => 'usd', // Valuta (all, usd, eur)
	'session_data' => 'abc', // Sesioni
	'cert_dir' => 'cert/dir' // Direktoria ku ndodhet certifikata
];

$auth = new Authenticate('111', '222', 3500, $options);


$user_id = 10;
$auth = new Authenticate('111', '222', 3500, [
		'order_id' => function() use($user_id) {
			return uniqid().$user_id;
		}]);


$auth = new Authenticate('111', '222', 3500);
$data = $auth->generate();


use Fadion\Raiffeisen\Notify;

$notify = new Notify('http://adresa/suksesit', 'http://adresa/deshtimit', $_POST);


$notify = new Notify('http://adresa/suksesit', 'http://adresa/deshtimit', $_POST);

// Kontrollon nese kerkesa vjen nga serveri
// i Gateway dhe transaksioni eshte i vlefshem.
$notify->isValid('1.1.1.1');

// Kthen pergjigje pozitive. Transaksioni kryhet.
$notify->success();

// Kthen pergjigje negative. Transaksioni nuk kryhet.
// Mund te kalohet edhe nje arsye opsionale.
$notify->error('Nuk arritem ta ruajme porosine. Provojeni serish.');


$notify = new Notify('http://adresa/suksesit', 'http://adresa/deshtimit', $_POST);

if ($notify->isValid('1.1.1.1')) {
	// valido porosine, stokun, etj.

	if (/* porosia eshte ne rregull */) {
		echo $notify->success();
	}
	else {
		echo $notify->error();
	}
}