PHPackages                             afzidan/laravelmpesa - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. afzidan/laravelmpesa

ActiveLaravel[Utility &amp; Helpers](/categories/utility)

afzidan/laravelmpesa
====================

A simple mpesa package for laravel framework

1.3.0(3y ago)014MITPHPPHP ^7.1|^8.0

Since Dec 15Pushed 3y agoCompare

[ Source](https://github.com/AFZidan/laravel_mpesa)[ Packagist](https://packagist.org/packages/afzidan/laravelmpesa)[ Docs](https://github/gathuku/laravel_mpesa)[ GitHub Sponsors](https://github.com/gathuku)[ RSS](/packages/afzidan-laravelmpesa/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Mpesa Package
=====================

[](#laravel-mpesa-package)

[![Codacy Badge](https://camo.githubusercontent.com/576dc03b1fd084fcb5429fd74caf0478ee5c3c9669cc0af399963cbbba423121/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3431346238343562643465633434613138393464346637613734393963323237)](https://app.codacy.com/app/gathuku/laravel_mpesa?utm_source=github.com&utm_medium=referral&utm_content=gathuku/laravel_mpesa&utm_campaign=Badge_Grade_Dashboard)[![Latest Version](https://camo.githubusercontent.com/5d6c8f7eb16c5dd33a3a63ce170e2cef3c1b9e3e5ae5405373a17b5ed6e947fb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f67617468756b752f6c61726176656c5f6d706573612e7376673f7374796c653d666c61742d737175617265)](https://github.com/gathuku/laravel_mpesa/releases)[![Issues](https://camo.githubusercontent.com/19bf2173fdedd3250d8600e2b666c12051144ec44d1b8072faa0c6613146ed83/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f67617468756b752f6c61726176656c5f6d706573612e7376673f7374796c653d666c61742d737175617265)](https://github.com/gathuku/laravel_mpesa/issues)[![Total Downloads](https://camo.githubusercontent.com/d7e807fd2f683888aadb04f0239c9fc30d56f300824dedac9e41b0cc845553ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67617468756b752f6c61726176656c6d706573612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/afzidan/laravelmpesa)[![Twiter](https://camo.githubusercontent.com/fe418a6f9b707e89bbb720a65c5dfc124c22c838ec6a6595c56ff24f26045f83/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f68747470732f6769746875622e636f6d2f67617468756b752f6c61726176656c5f6d706573612e7376673f7374796c653d736f6369616c3f7374796c653d736f6369616c)](https://twitter.com/Gathukumose)

This package helps you integrate your laravel application with Mpesa daraja APIs. The package eliminates (almost)all the hassles and lets you concentrate on what is important.

The package will help you integrate with the following APIs, available on mpesa daraja;

- C2B (consumer to business)
- B2C (business to cunsumer)
- Lipa na mpesa online(Mpesa Express)
- Reversal
- Transaction status
- Account balance

Documentation
-------------

[](#documentation)

You are looking at it. But we've also got [beautiful, fully navigable docs](https://beyode.co.ke/mpesa/).

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

[](#installation)

You can install this awesome package via composer

```
composer require afzidan/laravelmpesa
```

If you're using Laravel &gt;=5.5, this is all you have to do.

Should you still be on version 5.4 of Laravel, the final steps for you are to add the service provider of the package and alias the package. To do this open your `config/app.php` file.

Add a new line to the `providers` array:

```
 Gathuku\Mpesa\MpesaServiceProvider::class,
```

And optionally add a new line to the `aliases` array:

```
'Mpesa' => Gathuku\Mpesa\Facades\Mpesa::class,
```

### Happy Coding 🎉 💯

[](#happy-coding-tada-100)

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

[](#configuration)

Next, after the package has been installed run;

```
php artisan mpesa:install

```

or

```
php artisan vendor:publish
```

This will help in publishing `config/mpesa.php` file. This *mpesa config* file is where you will add all configurations for Mpesa APIs. This includes the environment your application is running in(sandbox or production), callback URLs and required credentials. You will obtain credentials from your `app` on Safaricom's [developer portal](https://developer.safaricom.co.ke).

```
