hopekelldev/laravel-klasha

Laravel SDK for Klasha Payments API

Maintainers

Package info

github.com/HopekellDev/laravel-klasha

pkg:composer/hopekelldev/laravel-klasha

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-06-10 21:04 UTC

This package is auto-updated.

Last update: 2026-06-10 21:29:52 UTC


README

Packagist Version PHP Version Laravel Version License: MIT Downloads Scrutinizer Code Quality Code Intelligence Status Build Status

Laravel Klasha Banner

A modern Laravel SDK for integrating with the Klasha Payments API.

Accept payments, create virtual accounts, manage transfers, verify transactions, fund wallets, and access Klasha financial services directly from your Laravel applications.

Laravel Klasha is a modern Laravel SDK that provides a clean and fluent interface for interacting with the Klasha API.

Accept payments, create virtual accounts, manage transfers, verify transactions, fund wallets, retrieve exchange rates, and access Klasha services directly from your Laravel applications.

Features

  • Laravel Auto Discovery
  • Facade Support
  • Service Container Binding
  • Fluent API Interface
  • Virtual Accounts
  • Payments
  • Transfers
  • Wallet Funding
  • Transaction Verification
  • Customer Payments
  • Mobile Money
  • Exchange Rates
  • Bank Listings
  • Country Listings
  • Currency Listings
  • Laravel 11, 12 & 13 Support

Requirements

Requirement Version
PHP 8.2+
Laravel 11+

Installation

Install via Composer:

composer require hopekelldev/laravel-klasha

Publish Configuration

php artisan vendor:publish --tag=klasha-config

This publishes:

config/klasha.php

Environment Configuration

Add the following values to your .env file:

KLASHA_PUBLIC_KEY=
KLASHA_SECRET_KEY=
KLASHA_ENCRYPTION_KEY=
KLASHA_BASE_URL=https://api.klasha.com

Configuration

return [

    'public_key' => env('KLASHA_PUBLIC_KEY'),

    'secret_key' => env('KLASHA_SECRET_KEY'),

    'encryption_key' => env('KLASHA_ENCRYPTION_KEY'),

    'base_url' => env(
        'KLASHA_BASE_URL',
        'https://api.klasha.com'
    ),

];

Quick Start

Using The Facade

use HopekellDev\Klasha\Facades\Klasha;

Example:

$response = Klasha::payments()
    ->transactions();

Dependency Injection

use HopekellDev\Klasha\KlashaManager;

class PaymentController
{
    public function index(KlashaManager $klasha)
    {
        return $klasha->payments()
            ->transactions();
    }
}

Available Services

Klasha::payments();

Klasha::transfers();

Klasha::bankAccounts();

Klasha::misc();

Payments API

Access payment services:

Klasha::payments();

Initialize Payment

Create a payment request.

$response = Klasha::payments()
    ->initialize([
        'amount' => 10000,
        'currency' => 'NGN',
        'email' => 'customer@example.com',
        'tx_ref' => uniqid(),
        'redirect_url' => route('payment.callback'),
    ]);

Verify Transaction

$response = Klasha::payments()
    ->verify('TRANSACTION_REFERENCE');

Fetch Transaction

$response = Klasha::payments()
    ->fetch('TRANSACTION_ID');

List Transactions

$response = Klasha::payments()
    ->transactions();

Refund Transaction

$response = Klasha::payments()
    ->refund([
        'transaction_id' => '123456'
    ]);

Wallet Funding

Generate card BINs for wallet funding.

$response = Klasha::payments()
    ->generateBin('BUSINESS_ID');

Mobile Money

Initiate mobile money payments.

$response = Klasha::payments()
    ->mobileMoney([
        'amount' => 500,
        'currency' => 'GHS',
        'phone_number' => '233XXXXXXXXX',
        'network' => 'MTN'
    ]);

Transfers API

Access transfer services:

Klasha::transfers();

Create Transfer Recipient

$response = Klasha::transfers()
    ->createRecipient([
        'bank_code' => '058',
        'account_number' => '0123456789',
        'account_name' => 'John Doe'
    ]);

Initiate Transfer

$response = Klasha::transfers()
    ->initiate([
        'amount' => 10000,
        'currency' => 'NGN',
        'recipient_id' => 'RECIPIENT_ID',
        'reference' => uniqid()
    ]);

Verify Transfer

$response = Klasha::transfers()
    ->verify('TRANSFER_REFERENCE');

Fetch Transfer

$response = Klasha::transfers()
    ->fetch('TRANSFER_ID');

List Transfers

$response = Klasha::transfers()
    ->all();

Virtual Accounts API

Access virtual account services:

Klasha::bankAccounts();

Create Virtual Account

Klasha requires encrypted payloads.

$response = Klasha::bankAccounts()
    ->createVirtualAccount([
        'first_name' => 'John',
        'last_name' => 'Doe',
        'email' => 'john@example.com',
        'currency' => 'NGN'
    ]);

Get Virtual Account

$response = Klasha::bankAccounts()
    ->getVirtualAccount('ACCOUNT_ID');

List Virtual Accounts

$response = Klasha::bankAccounts()
    ->virtualAccounts();

Disable Virtual Account

$response = Klasha::bankAccounts()
    ->disableVirtualAccount('ACCOUNT_ID');

Utility APIs

Access miscellaneous Klasha services.

Klasha::misc();

Banks

Retrieve supported banks.

$response = Klasha::misc()
    ->banks();

Countries

Retrieve supported countries.

$response = Klasha::misc()
    ->countries();

Currencies

Retrieve supported currencies.

$response = Klasha::misc()
    ->currencies();

Exchange Rates

$response = Klasha::misc()
    ->exchangeRate([
        'source_currency' => 'USD',
        'destination_currency' => 'NGN',
        'amount' => 100
    ]);

Health Check

$response = Klasha::misc()
    ->health();

Response Format

Successful response:

[
    'success' => true,
    'message' => 'Request successful',
    'data' => [
        //
    ],
]

Error response:

[
    'success' => false,
    'message' => 'Invalid API Key',
    'data' => null,
]

Error Handling

try {

    $response = Klasha::payments()
        ->initialize($payload);

} catch (\Throwable $exception) {

    report($exception);

    return response()->json([
        'message' => $exception->getMessage()
    ], 500);

}

Service Container

Resolve the SDK from Laravel's service container:

app('klasha');

or

app(
    \HopekellDev\Klasha\KlashaManager::class
);

Testing

Run tests:

composer test

Changelog

v1.0.0

  • Initial Release
  • Payments API
  • Transfers API
  • Virtual Accounts API
  • Wallet Funding
  • Utility APIs
  • Laravel Auto Discovery
  • Facade Support

Security

If you discover any security vulnerability, please send an email to:

hopekelltech@gmail.com

All security vulnerabilities will be addressed promptly.

Contributing

Contributions are welcome.

Fork Repository

git clone https://github.com/HopekellDev/laravel-klasha.git

Create Branch

git checkout -b feature/my-feature

Commit Changes

git commit -m "Add my feature"

Push Changes

git push origin feature/my-feature

Open Pull Request

Submit a pull request describing your changes.

License

MIT License

Copyright (c) 2026 HopekellDev

Author

HopekellDev

Website: https://www.hopekelltech.com

Email: hopekelltech@gmail.com

GitHub: https://github.com/HopekellDev

Packagist: https://packagist.org/packages/hopekelldev/laravel-klasha

Made with ❤️ for the Laravel Community.