ElmMac - Laravel iKhokha Payment Integration API π³
Official Laravel package to integrate iKhokha Pay Links and Webhooks into your Laravel projects.
This Laravel package provides a native iKhokha payment integration layer, complete with:
- Webhook handling
- Database logging
- API client functionality
- Optional UI blade views for frontend integration
- Paylink creation
- Easily extendable API client
Perfect for:
β SaaS platforms β Marketplaces β Payment-based apps β Donation systems β Subscription-like flows
π Secure, scalable, and modular β ideal for custom Laravel SaaS and marketplaces.
β
Webhook listener & processor
β
Auto-persist IkhokhaPayment records
β
Extendable IkhokhaClient for outbound API calls
β
Built for Laravel 9/10+
β
Clean PSR-4 package structure
β
Optional config, views, and migration publishing
β
Optional UI views included (Blade templates)
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
composer require elmmac/ikhokhaFor Laravel < 5.5 or explicit config
'providers' => [
Elmmac\Ikhokha\IkhokhaServiceProvider::class,
],php artisan vendor:publish --tag=ikhokha-configThis publishes: config/ikhokha.php
IKHOKHA_APP_ID=YOUR_APP_ID
IKHOKHA_SIGN_SECRET=YOUR_SECRET
IKHOKHA_WEBHOOK_URL=https://yourdomain.com/api/ikhokha/callbackphp artisan vendor:publish --tag=ikhokha-viewsViews will be published to: resources/views/ikhokha
Use them as base templates or customize freely.
php artisan vendor:publish --tag=ikhokha-migrationsMigration will be published to: database/migrations/
Then run:
php artisan migrateModel:
Elmmac\Ikhokha\Models\IkhokhaPaymentTable: ikhokha_payments
Add relationship in your User.php:
public function ikhokha_payments()
{
return $this->hasMany(IkhokhaPayment::class);
}And in IkhokhaPayment.php:
public function user()
{
return $this->belongsTo(\App\Models\User::class, 'user_id');
}π Example Manual Entry:
IkhokhaPayment::create([
'user_id' => $user->id ?? null,
'customer_email' => $user->email ?? $request->input(key: 'customer_email', default: 'misael@elmmac.co.za'),
'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,
]);π Create Payment Link Payload - REQUEST | Refer to π iKhokha API Overview for more.
Use this structure to initiate payment (All iKhokha Requests & Responses MUST be in JSON format):
$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'),
]
];Create Paylink/Payment Link Response Object
CREATE PAYMENT LINK - RESPONSE
{
"responseCode": "00",
"message": "",
"paylinkUrl": "https://securepay.ikhokha.red/2zh1zj6y8xpb0g3",
"paylinkID": "2zh1zj6y8xpb0g3",
"externalTransactionID": "TRANS789" // $transactionId
}
π Webhook Setup | Refer to π iKhokha API Overview for more.
π¬ Webhook URL:
POST /api/ikhokha/webhook
Required headers:
ik-appid
ik-sign
Content-Type: application/json
π¨ Sample Payload:
{
"paylinkID": "2zh1zj6y8xpb0g3", // Gotten from Create Payment Link Response
"status": "SUCCESS",
"externalTransactionID": "IKH_REF_CODE_9911",
"responseCode": "00"
}| Method | URL | Purpose |
|---|---|---|
| POST | /ikhokha-initiate |
Create payment link |
| GET | /ikhokha/success |
Redirect page after payment |
| GET | /ikhokha/failed |
Failed payment view |
| GET | /ikhokha/cancel |
Cancel payment view |
| POST | /api/ikhokha/webhook |
Webhook callback |
For dev reminders:
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 migrationsUse only the ones you need! π‘
- Full unit testing with PHPUnit
- Laravel Octane compatibility
- Tokenized card billing
- Refunds & reversals
- Multi-merchant support
- Optional payment UI component scaffolds
iKhokha Subscription Tokenization Eloquent Traits (Billable) Octane compatibility
Pull requests welcome. Open an issue for proposals or fixes.
Make sure tests pass if you're submitting functional changes.
Developed with π by ElmMac Pty Ltd
Maintained by @ElmMac - Misael Cruise Mutege β WhatsApp: +27786411181 Durban, South Africa
Digital Dev | Hustler Mode: ON πΌ
MIT License Β© ElmMac " ||| just edit according to the chamges say like the folder structure excluding the package folder, etc depending on what has changed so far.