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)017MITBladePHP ^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 1mo ago

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

28

—

LowBetter than 54% of packages

Maintenance46

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

417d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/583e582f9d02cba2fdb20c70409c6fb7498c992fecba65beaeaa1cfd83736af0?d=identicon)[brunoadul](/maintainers/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

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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