PHP code example of dgeorgiev / epay

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

    

dgeorgiev / epay example snippets


php artisan vendor:publish
 php

    $invoice     = sprintf("%.0f", rand(1, 50) * 105);
    $amount      = '22,80';
    $expiration  = '01.08.2020';
    $description = 'Test';

    Epay::setData(
        $invoice,
        $amount,
        $expiration,
        $description
    );

 PHP
    Route::post('receive', function(){

        $receiver = Epay::receiveNotification(Request::all());

        /**
        * Update order or status of payment
        *
        *    array (
        *      'invoice' => '1890',
        *      'status' => 'PAID',
        *      'pay_date' => '20151204143730',
        *      'stan' => '036257',
        *      'bcode' => '036257',
        *    ),
        *
        **/
        foreach($receiver['items'] as $item){
            Log::info($item);
            Log::info($item['status']);
            Log::info($item['invoice']);
        }

        return $receiver['response'];

    });

    <form action="{{ Epay::getSubmitUrl() }}" method="post">
        {!! Epay::generateHiddenInputs() !!}

        // your code here

        <button type=submit>Изпрати</button>
    </form>