PHPackages                             brunoadul/mpesa - 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. brunoadul/mpesa

ActiveBagisto-package[Payment Processing](/categories/payments)

brunoadul/mpesa
===============

Mpesa payment integration for Bagisto

v1.0.0(1y ago)022MITBladePHP ^8.1

Since Mar 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/BrunoAdul/bagisto-mpesa)[ Packagist](https://packagist.org/packages/brunoadul/mpesa)[ RSS](/packages/brunoadul-mpesa/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

M-Pesa Payment Gateway for Bagisto
==================================

[](#m-pesa-payment-gateway-for-bagisto)

This package provides M-Pesa payment integration for Bagisto e-commerce platform.

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

[](#installation)

1. Add the package to your Bagisto installation:

```
composer require brunoadul/mpesa
```

2. Register the service provider in `config/app.php`:

```
'providers' => [
    // Other service providers...
    Brunoadul\Mpesa\Providers\MpesaServiceProvider::class,
],
```

3. Publish the package assets:

```
php artisan vendor:publish --provider="Brunoadul\Mpesa\Providers\MpesaServiceProvider" --tag=mpesa-assets
php artisan vendor:publish --provider="Brunoadul\Mpesa\Providers\MpesaServiceProvider" --tag=mpesa-config
```

4. Clear the cache:

```
php artisan cache:clear
php artisan config:clear
php artisan view:clear
```

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

[](#configuration)

### Environment Variables

[](#environment-variables)

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

```
# M-Pesa Configuration
MPESA_SANDBOX=true
MPESA_BUSINESS_SHORTCODE=174379
MPESA_CONSUMER_KEY=your_consumer_key
MPESA_CONSUMER_SECRET=your_consumer_secret
MPESA_PASSKEY=your_passkey
MPESA_INITIATOR_NAME=your_initiator_name
MPESA_INITIATOR_PASSWORD=your_initiator_password

```

### Sandbox Testing

[](#sandbox-testing)

For sandbox testing, you can use the following credentials:

- Business Shortcode: 174379
- Consumer Key: Get from Safaricom Developer Portal
- Consumer Secret: Get from Safaricom Developer Portal
- Passkey: Get from Safaricom Developer Portal

### Production Configuration

[](#production-configuration)

For production, update your `.env` file with your production credentials:

```
MPESA_SANDBOX=false
MPESA_BUSINESS_SHORTCODE=your_production_shortcode
MPESA_CONSUMER_KEY=your_production_consumer_key
MPESA_CONSUMER_SECRET=your_production_consumer_secret
MPESA_PASSKEY=your_production_passkey
MPESA_INITIATOR_NAME=your_production_initiator_name
MPESA_INITIATOR_PASSWORD=your_production_initiator_password

```

Troubleshooting
---------------

[](#troubleshooting)

### Wrong Credentials Error

[](#wrong-credentials-error)

If you see "Failed to initiate STK push: Wrong credentials" error, check the following:

1. Ensure your Consumer Key and Consumer Secret are correct
2. Make sure your Business Shortcode is correct
3. Verify that your Passkey is correct
4. Check that you're using the correct environment (sandbox or production)

### API Connection Issues

[](#api-connection-issues)

If you're having trouble connecting to the Safaricom API:

1. Ensure your server can make outbound HTTPS requests
2. Check that your server's SSL certificates are up to date
3. Verify that your callback URL is publicly accessible

Support
-------

[](#support)

For support, please contact me at

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance43

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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

463d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/59060792?v=4)[Bruno Adul](/maintainers/brunoadul)[@BrunoAdul](https://github.com/BrunoAdul)

---

Top Contributors

[![BrunoAdul](https://avatars.githubusercontent.com/u/59060792?v=4)](https://github.com/BrunoAdul "BrunoAdul (20 commits)")

### Embed Badge

![Health badge](/badges/brunoadul-mpesa/health.svg)

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

###  Alternatives

[msilabs/bkash

bKash Payment Gateway API for Laravel Framework.

181.2k](/packages/msilabs-bkash)[patryqhyper/polish_payments_api

Library for polish payment providers

141.6k](/packages/patryqhyper-polish-payments-api)

PHPackages © 2026

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