PHP code example of elmmac / ikhokha

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

    

elmmac / ikhokha example snippets


'providers' => [
    Elmmac\Ikhokha\IkhokhaServiceProvider::class,
],

Elmmac\Ikhokha\Models\IkhokhaPayment

public function ikhokha_payments()
{
    return $this->hasMany(IkhokhaPayment::class);
}

public function user()
{
    return $this->belongsTo(\App\Models\User::class, 'user_id');
}

IkhokhaPayment::create([
    'user_id' => $user->id ?? null,
    'customer_email' => $user->email ?? $request->input(key: 'customer_email', default: '[email protected]'),
    'transaction_id' => $externalTransactionID,
    'description' => $request->input('description', 'Payment'),
    'paylink_id' => $data['paylinkID'] ?? null,
    'amount' => $amount,
    'currency' => $currency,
    'status' => 'pending',
    'payment_url' => $data['paylinkUrl'] ?? null,
    'webhook_signature' => $ikSign,
    'metadata' => $data,
]);
 Request Object
$payload = [
    "entityID" => $appID,
    "amount" => (int) $amount * 100,
    "currency" => $currency,
    "requesterUrl" => url()->current(),
    "mode" => $mode,
    "externalTransactionID" => $externalTransactionID,
    "urls" => [
        "callbackUrl" => route(name: 'ikhokha.webhook'),
        "successPageUrl" => route(name: 'ikhokha.success'),
        "failurePageUrl" => route(name: 'ikhokha.failed'),
        "cancelUrl" => route(name: 'ikhokha.cancel'),
    ]
];


elmmac/ikhokha/
│
├── composer.json
│
├── config/
│   └── ikhokha.php
│
├── database/
│   └── migrations/
│       └── 2025_06_30_130134_create_ikhokha_payments_table.php
│
├── resources/
│   └── views/
│       └── ikhokha/
│           ├── success.blade.php
│           ├── failed.blade.php
│           └── cancel.blade.php
│
├── src/
│   ├── Http/
│   │   └── Controllers/
│   │       └── IkhokhaPaymentController.php
│   │
│   ├── Models/
│   │   └── IkhokhaPayment.php
│   │
│   ├── Services/
│   │   └── IkhokhaClient.php
│   │
│   ├── routes/                     ← **ROUTES ARE HERE**
│   │   ├── api.php
│   │   └── web.php
│   │
│   └── IkhokhaServiceProvider.php
│
└── README.md



bash
php artisan vendor:publish --tag=ikhokha-config
bash
php artisan vendor:publish --tag=ikhokha-views
bash
php artisan vendor:publish --tag=ikhokha-migrations
bash
php artisan migrate
bash
php artisan vendor:publish --tag=ikhokha-config      # Publish config
php artisan vendor:publish --tag=ikhokha-views       # Publish views
php artisan vendor:publish --tag=ikhokha-migrations  # Publish migrations