PHPackages                             kpay/laravel-kpay - 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. [Payment Processing](/categories/payments)
4. /
5. kpay/laravel-kpay

ActiveLibrary[Payment Processing](/categories/payments)

kpay/laravel-kpay
=================

Laravel 12 package for integrating with the K-Pay payment gateway.

v1.0.0(4mo ago)01[2 PRs](https://github.com/dream-hun/kpay/pulls)MITPHPPHP ^8.2CI passing

Since Dec 18Pushed 4mo agoCompare

[ Source](https://github.com/dream-hun/kpay)[ Packagist](https://packagist.org/packages/kpay/laravel-kpay)[ RSS](/packages/kpay-laravel-kpay/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (5)Used By (0)

K-Pay Laravel Package
=====================

[](#k-pay-laravel-package)

Laravel 12 package for integrating with the **K-Pay** payment gateway.

Based on the official K-Pay API documentation:

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

[](#installation)

Require the package via Composer:

```
composer require kpay/laravel-kpay
```

Publish the config:

```
php artisan vendor:publish --tag=kpay-config
```

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

[](#configuration)

Set these environment variables:

```
KPAY_BASE_URL=https://pay.esicia.com/
KPAY_API_KEY=your_api_key
KPAY_USERNAME=your_username
KPAY_PASSWORD=your_password

KPAY_RETAILER_ID=YOUR_RETAILER_ID
KPAY_RETURL=https://your-app.com/kpay/callback
KPAY_REDIRECTURL=https://your-app.com/payment/return
KPAY_CURRENCY=RWF
```

Usage
-----

[](#usage)

### Initiate a payment

[](#initiate-a-payment)

```
use KPay;

$result = KPay::pay([
    'msisdn' => '250783300000',
    'email' => 'customer@example.com',
    'details' => 'Order #12345',
    'refid' => 'ORDER123456789',
    'amount' => 5000,
    'cname' => 'John Doe',
    'cnumber' => 'CUST001',
    'pmethod' => 'momo', // momo, cc, spenn
]);

// If success == 1, redirect user to $result['url']
```

### Check payment status

[](#check-payment-status)

```
use KPay;

$status = KPay::checkStatus('ORDER123456789');
// statusid: 01 (success), 02 (failed), 03 (pending)
```

### Webhook (Callback)

[](#webhook-callback)

By default the package registers:

- `POST /kpay/callback`

K-Pay requires your endpoint to respond:

```
{ "tid": "...", "refid": "...", "reply": "OK" }
```

The controller also dispatches events based on `statusid`:

- `KPay\LaravelKPay\Events\PaymentSucceeded`
- `KPay\LaravelKPay\Events\PaymentFailed`
- `KPay\LaravelKPay\Events\PaymentPending`

To customize the path or middleware:

```
KPAY_CALLBACK_PATH=kpay/callback
KPAY_CALLBACK_MIDDLEWARE=api
KPAY_CALLBACK_ENABLED=true
```

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please follow our commit message convention (Conventional Commits). See `CONTRIBUTING.md`.

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance75

Regular maintenance activity

Popularity1

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.2% 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

144d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8de36c34cdeea834b40c546db4a5a78033a138e642543cb7d3873db87e2f3385?d=identicon)[DreamChaser](/maintainers/DreamChaser)

---

Top Contributors

[![dream-hun](https://avatars.githubusercontent.com/u/71966425?v=4)](https://github.com/dream-hun "dream-hun (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

laravelpaymentsvisamastercardmomokpayk-pay

###  Code Quality

TestsPest

Static AnalysisRector

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[knox/pesapal

A laravel package that integrates into the pesapal api

29106.3k](/packages/knox-pesapal)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[asciisd/knet

Knet package is provides an expressive, fluent interface to KNet's payment services.

141.1k](/packages/asciisd-knet)[a17mad/laravel-cybersource

This package wraps the Cybersource SOAP API in a convenient, easy to use package for Laravel.

136.8k](/packages/a17mad-laravel-cybersource)

PHPackages © 2026

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