PHP code example of melogail / telr-laravel

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

    

melogail / telr-laravel example snippets


return [

    // ...other configs

    'response_path' => [
        'return_auth' => '/:path/to_success_page',
        'return_decl' => '/:path/to_decline_page',
        'return_can' => '/:path/to_cancel_page',
    ],
];

'aliases' => Facade::defaultAliases()->merge([
        // 'ExampleClass' => App\Example\ExampleClass::class,
        'TelrLaravel' => \Melogail\TelrLaravel\Facades\TelrLaravel::class,

    ])->toArray(),

use Melogail\TelrLaravel\TelrLaravel;

$telr_laravel = new TelrLaravel();

$telr_laravel->makePayment('183-487-143', 9.50, 'Cart generated by John Doe on 2023-1-16');

$billing_parameters = [
    'bill_fname' => $first_name,
    'bill_sname' => $sure_name,
    'bill_addr1' => $address1,
    'bill_phone' => $phone,
    'bill_city' => $city,
    'bill_country' => $country,
    'bill_email' => $email
];

$telr_laravel->makePayment('183-487-143', 9.50, 'Cart generated by John Doe on 2023-1-16')
    ->pay($billing_parameters);

use Melogail\TelrLaravel\TelrLaravel;

$telr_laravel = new TelrLaravel();

$billing_parameters = [
    'bill_fname' => $first_name,
    'bill_sname' => $sure_name,
    'bill_addr1' => $address1,
    'bill_phone' => $phone,
    'bill_city' => $city,
    'bill_country' => $country,
    'bill_email' => $email
];

$telr_laravel->makePayment('183-487-143', 9.50, 'Cart generated by John Doe on 2023-1-16')->pay($billing_parameters);

use Illuminate\Http\Request;
use \Melogail\TelrLaravel\Facades\TelrLaravel;

class PaymentController extends Controller {

    public function success(Request $request){
    
        // Calling setTransactionStatus facade.
        TelrLaravel::setTransactionStatus($request);
        
        return view( //... success view page);
    }
    
    
    public function decline(Request $request){
    
        // Calling setTransactionStatus facade.
        TelrLaravel::setTransactionStatus($request);
        
        return view( //... decline view page);
    }
    
    
    public function cancel(Request $request){
    
        // Calling setTransactionStatus facade.
        TelrLaravel::setTransactionStatus($request);
        
        return view( //... cancel view page);
    }

}

bash
php artisan vendor:publish --provider="Melogail\TelrLaravel\TelrLaravelServiceProvider" --tag="migrations"
php artisan migrate
bash
php artisan vendor:publish --provider="Melogail\TelrLaravel\TelrLaravelServiceProvider" --tag="config"