PHP code example of yanosh-k / epay

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

    

yanosh-k / epay example snippets



     = new Yanoshk\Epay(array(/*...*/));


     = new Yanoshk\Epay(array(/*...*/));

// Only the client secret is needed for this operation
$epay = new Yanoshk\Epay(array('clientSecret' => 'DSY6AJN6XOT7VEMV2H77LXVMC2D4B9X4JSDSCNEQ7WPYYJZ5JF1FR5JZS6P23M99'));


// Will return an empty array if the passed that was incorrect
$data            = $epay->getNotificationData($_POST);


// Contained data (show for example only)
// This is the first of many (most times will be just one) transaction items
$transactionInfoFirst = isset($data[0]) ? $data[0] : array();

// One ore more transaction items might be present
$response = [];
foreach ($data as $transactionInfo) {
    $response[]   = Yanoshk\Epay::generateNotificationResponse([
            'error'     => empty($transactionInfo) ? 'Not valid CHECKSUM' : null,
            'status'    => $existsOrder ? 'OK' : 'ERR',
            'invoiceID' => $transactionInfo['INVOICE']
    ]);
}

echo implode('', $response);