PHP code example of escapeboy / epay

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

    

escapeboy / epay example snippets


Escapeboy\Epay\EpayServiceProvider::class,

'Epay' => Escapeboy\Epay\EpayServiceProvider::class,

return [
	'submit_url' => 'https://devep2.datamax.bg/ep2/epay2_demo/', // test submit url
	// 'submit_url' => 'https://www.epay.bg/', // production submit url
	'secret' => REQUIRED, // client secret
	'client_id' => REQUIRED, // client id
	'expire_days' => 1 // expire time for transations in days
	'success_url' => 'epay/success', // return url for success
	'cancel_url' => 'epay/cancel', // return url for cancel
];

echo \Epay::generateInputFields([
				'invoice' => '000001', // invoice ID
				'amount' => 100, // amount
				'descr' => 'Some info about order' // info about order
]);

Route::post('epay/notification', function(){

	$notification_data = \Epay::receiveNotification(request()->all());
		/**
        * $notification_data contains array with data:
        *
        *    array (
        *      'invoice' => 'your_order_id',
        *      'status' => 'PAID',
        *      'pay_date' => '20162304154530',
        *      'stan' => '045138',
        *      'bcode' => '045138'
        *    ),
        *
        **/
	return response()->make($notification_data['response']);
});
bash
php artisan vendor:publish --provider="Escapeboy\Epay\EpayServiceProvider" --tag="config"