PHP code example of sargilla / firstdata

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

    

sargilla / firstdata example snippets



Firstdata::getDateTime() // It returns formated datetime


Firstdata::createExtendedHash($totalcharge,$currency,$invoiceNumber) 


Route::get('first-data', 'Payments\FirstDataController@showForm');
Route::post('first-data/response/success', 'Payments\FirstDataController@success');
Route::post('first-data/response/failure', 'Payments\FirstDataController@failure');
Route::post('first-data/response/notification', 'Payments\FirstDataController@notification');

namespace App\Http\Controllers\Payments;

use Carbon\Carbon;
use Illuminate\Support\Facades\Log;

class FirstDataController {

    public function success()
    {
        // PROCESS SUCCESS AND REDIRECT
        Log::notice('OPERATION SUCCESS');
        Log::info(request()->all());
        dd(request()->all());
    }

    public function failure()
    {
        // PROCESS FAILURE AND REDIRECT
        Log::notice('OPERATION FAILED');
        Log::info(request()->all());
        dd(request()->all());
    }

    public function notification()
    {
        // PROCESS NOTIFICATION
        Log::notice('OPERATION NOTIFICATION');
        Log::info(request()->all());
        dd(request()->all());
    }
}

php artisan vendor:publish --tag=firstdata