PHPackages                             chebon/pezesha-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. chebon/pezesha-laravel

ActiveLibrary[API Development](/categories/api)

chebon/pezesha-laravel
======================

Laravel package for Pezesha API integration

v0.1.0-alpha(1y ago)00GNUPHPPHP ^7.4|^8.0

Since Feb 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/chebonv/pezesha-laravel)[ Packagist](https://packagist.org/packages/chebon/pezesha-laravel)[ RSS](/packages/chebon-pezesha-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Pezesha Laravel Package
=======================

[](#pezesha-laravel-package)

A Laravel package for seamless integration with the Pezesha API, enabling loan management, payments, and financial services.

[!["Buy Me A Coffee"](https://camo.githubusercontent.com/9f44ce2dc3b3eecdd02598900866ffc518801df1932849703dae1e5ce5031070/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f6f72616e67655f696d672e706e67)](https://www.buymeacoffee.com/chebon)

Installation
------------

[](#installation)

Install the package via composer:

```
composer require chebon/pezesha-laravel
```

Configuration
-------------

[](#configuration)

1. Publish the configuration file:

```
php artisan vendor:publish --provider="Chebon\PezeshaLaravel\PezeshaServiceProvider"
```

2. Add the following variables to your `.env` file:

```
PEZESHA_CLIENT_ID=your_client_id
PEZESHA_CLIENT_SECRET=your_client_secret
PEZESHA_BASE_URL=https://api.pezesha.com
PEZESHA_CHANNEL=your_channel
```

Usage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

```
use Chebon\PezeshaLaravel\Pezesha;

$pezesha = new Pezesha();
```

### Authentication

[](#authentication)

The package handles authentication automatically, but you can manually authenticate:

```
try {
    $result = $pezesha->authenticate();
    $token = $result['access_token'];
} catch (PezeshaException $e) {
    // Handle authentication error
}
```

### Loan Management

[](#loan-management)

#### 1. Get Loan Offers

[](#1-get-loan-offers)

```
try {
    $result = $pezesha->getLoanOffers('MERCHANT_ID');
    $loanLimit = $result['data']['loan_limit'];
    $interestRate = $result['data']['interest_rate'];
} catch (PezeshaException $e) {
    // Handle error
}
```

#### 2. Apply for Loan

[](#2-apply-for-loan)

```
$loanDetails = [
    'amount' => '10000',
    'duration' => '12',
    'interest' => '1200',
    'rate' => '12',
    'fee' => '500',
    'payment_details' => [
        'type' => 'mobile_money',
        'number' => '254712345678',
        'callback_url' => 'https://example.com/callback'
    ]
];

try {
    $result = $pezesha->applyLoan('PEZ123', $loanDetails);
    $loanId = $result['data']['loan_id'];
} catch (PezeshaException $e) {
    // Handle error
}
```

#### 3. Check Loan Status

[](#3-check-loan-status)

```
try {
    $result = $pezesha->getLoanStatus('MERCHANT_ID');
    $status = $result['data']['loan_status'];
} catch (PezeshaException $e) {
    // Handle error
}
```

#### 4. Get Loan History

[](#4-get-loan-history)

```
try {
    $result = $pezesha->getLoanHistory('MERCHANT_ID', 1); // page number optional
    $loans = $result['data']['loans'];
} catch (PezeshaException $e) {
    // Handle error
}
```

#### 5. Get Active Loans

[](#5-get-active-loans)

```
try {
    $result = $pezesha->getActiveLoans('MERCHANT_KEY');
    $activeLoans = $result['data']['active_loans'];
} catch (PezeshaException $e) {
    // Handle error
}
```

#### 6. Get Loan Repayment Schedule

[](#6-get-loan-repayment-schedule)

```
try {
    $result = $pezesha->getLoanRepaymentSchedule('MERCHANT_ID');
    $schedule = $result['data']['schedule'];
} catch (PezeshaException $e) {
    // Handle error
}
```

#### 7. Upload Transaction Data

[](#7-upload-transaction-data)

Upload historical transaction data for credit scoring:

```
$transactions = [
    [
        'transaction_id' => 'TRX123',
        'merchant_id' => 'MERCH123',
        'face_amount' => 1000,
        'transaction_time' => '2024-01-01 12:00:00',
        'other_details' => [
            [
                'key' => 'product',
                'value' => 'laptop'
            ]
        ]
    ]
];

$otherDetails = [
    'business_type' => 'electronics',
    'years_in_business' => '5'
];

try {
    $result = $pezesha->uploadDataTransactions(
        'MERCHANT123',
        $transactions,
        $otherDetails
    );

    if ($result['status'] === 'success') {
        // Data uploaded successfully
    }
} catch (PezeshaException $e) {
    // Handle error
}
```

Note:

- Maximum 200 transactions allowed per request
- Required fields for each transaction:
    - transaction\_id (string)
    - merchant\_id (string)
    - face\_amount (numeric)
    - transaction\_time (format: YYYY-MM-DD HH:mm:ss)
- Optional: other\_details array with key-value pairs

### Payments

[](#payments)

#### Initiate STK Push

[](#initiate-stk-push)

```
try {
    $result = $pezesha->initiateStkPush(
        amount: '1000',
        phone: '+254712345678',
        account: 'MERCHANT123'
    );

    if ($result['status'] === 200 && !$result['error']) {
        // STK push successful
        $message = $result['message'];
    }
} catch (PezeshaException $e) {
    // Handle error
}
```

Note: Phone number must be in the format +254XXXXXXXXX

Error Handling
--------------

[](#error-handling)

The package throws `PezeshaException` for all errors. Always wrap API calls in try-catch blocks:

```
use Chebon\PezeshaLaravel\Exceptions\PezeshaException;

try {
    $result = $pezesha->someMethod();
} catch (PezeshaException $e) {
    // Log error
    Log::error('Pezesha API Error: ' . $e->getMessage());

    // Handle error appropriately
    return response()->json(['error' => $e->getMessage()], 500);
}
```

Testing
-------

[](#testing)

Run the test suite:

```
./vendor/bin/phpunit
```

Requirements
------------

[](#requirements)

- PHP ^7.4|^8.0
- Laravel ^8.0|^9.0|^10.0
- Guzzle ^7.0

License
-------

[](#license)

MIT License. See [LICENSE.md](LICENSE.md) for details.

Support
-------

[](#support)

For support, email  or create an issue in the GitHub repository.

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

557d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c02e8b10785383be8bdcdfc74535da977bfc60488bc8239c0781fc96d9235069?d=identicon)[Vincent K Chebon](/maintainers/Vincent%20K%20Chebon)

---

Top Contributors

[![chebonv](https://avatars.githubusercontent.com/u/19566207?v=4)](https://github.com/chebonv "chebonv (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chebon-pezesha-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/chebon-pezesha-laravel/health.svg)](https://phpackages.com/packages/chebon-pezesha-laravel)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.7M3.4k](/packages/craftcms-cms)[illuminate/http

The Illuminate Http package.

11938.5M8.2k](/packages/illuminate-http)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5226.7k](/packages/simplestats-io-laravel-client)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1349.3k1](/packages/jasara-php-amzn-selling-partner-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
