PHP code example of freelancernishad / laravel-ekpay

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

    

freelancernishad / laravel-ekpay example snippets


use FreelancerNishad\Ekpay\Services\EkpayService;

public function checkout(EkpayService $ekpayService)
{
    $trns_info = [
        "trnx_amt" => 100,
        "trnx_currency" => "BDT",
        "trnx_id" => "ORDER_" . uniqid(),
        "ord_det" => "Payment for Order #123",
    ];

    $cust_info = [
        "cust_email" => "[email protected]",
        "cust_name" => "John Doe",
        "cust_mobo_no" => "017XXXXXXXX",
    ];

    $result = $ekpayService->initiatePayment($trns_info, $cust_info);

    return redirect()->to($result['payment_url']);
}

$meta = [
    'student_id' => 101,
    'month' => 'May',
    'year' => 2026
];
$ekpayService->initiatePayment($trns_info, $cust_info, [], $meta);

namespace App\Models;
use FreelancerNishad\Ekpay\Models\EkpayLog as BaseLog;

class CustomEkpayLog extends BaseLog {
    protected $fillable = ['user_id', 'trnx_id', 'my_custom_column', ...];
}

'models' => [
    'log' => \App\Models\CustomEkpayLog::class,
],
bash
php artisan vendor:publish --tag=ekpay-config
php artisan vendor:publish --tag=ekpay-migrations
bash
php artisan migrate