PHPackages                             datavisionint/laravel-mlipa - 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. datavisionint/laravel-mlipa

ActiveLibrary[Payment Processing](/categories/payments)

datavisionint/laravel-mlipa
===========================

Laravel package for M-Lipa payment Gateway

1.1.4(10mo ago)026MITPHPPHP ^8.1|^8.2

Since Sep 20Pushed 10mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (12)Versions (13)Used By (0)

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

[](#installation)

You can install the package via composer:

```
composer require datavisionint/laravel-mlipa
```

By default logs are allowed, so the logs tables will be required. To publish logs tables, run:

```
php artisan vendor:publish --tag="mlipa-migrations"
php artisan migrate
```

If you are not using logs, and wish to customise other configurations, publish the configuration using:

```
php artisan vendor:publish --tag="mlipa-config"
```

This is the contents of the published config file:

```
use DatavisionInt\Mlipa\Models\MlipaCollection;
use DatavisionInt\Mlipa\Models\MlipaPayout;

return [

    /**
     * The client key from the mlipa developer portal
     */
    'client_key' => env('MLIPA_CLIENT_KEY'),

    /**
     * The client secret from the mlipa developer portal
     */
    'client_secret' => env('MLIPA_CLIENT_SECRET'),

    /**
     * Webhook route
     *
     * The route exposed in your application that will be used to receive webhooks
     */
    'webhook_route' => 'mlipa/webhook',

    /**
     * Webhook route name
     *
     * The route name used for webhook when using route() method
     */
    'webhook_route_name' => 'mlipa.webhook',

    /**
     * Payout route
     *
     * The route exposed in your application that will be used to verify payouts
     */
    'payout_verification_route' => 'mlipa/payouts/verification',

    /**
     * Payout route name
     *
     * The route name used for payout verification when using route() method
     */
    'payout_verification_route_name' => 'mlipa.payouts.verification',

    /**
     * When set to false errors will be thrown when they occur and you will have to
     * handle them yourself using try catch blocks, and when set to true, the errors
     * will be silently handled and false status will be returned. The error can be found
     * in the logs.
     */
    'handle_errors' => true,

    /**
     * When set to true, the transactions will be logged to database, and you will be
     * required to create the table by running the migration
     */
    'log_requests' => true,

    /**
     * When set to true, the transactions will be logged to database, and you will be
     * required to create the table by running the migration
     */
    'log_events' => true,

    /**
     * The model to be used for payouts, incase you wish to change the model usde or database
     * table name, extend this model and then change the $table property.
     */
    'payout_model' => MlipaPayout::class,

    /**
     * The model to be used for collections. Incase you wish to change the model used
     * or database table name, extend this model and then change $table property
     */
    'collection_model' => MlipaCollection::class,

    /**
     * The root URL of the M-lipa requests
     */
    'root_url' => 'https://developer.mlipa.co.tz',

    /**
     * Endpoints for transactions
     */
    'endpoints' => [

        /**
         * Authentication endpoint
         *
         * The endpoint used for requesting the session token
         */
        'authentication' => '/v2/auth/token',

        /**
         * PushUSSD endpoint
         *
         * The endpoint used for initiating PushUSSD
         */
        'pushussd' => '/v2/pushussd/create',

        /**
         * Billing endpoint
         *
         * The endpoint used for initiating billing transaction
         */
        'billing' => '/v2/billings/create',

        /**
         * Payout endpoint
         *
         * The endpoint used for initiating a payout request
         */
        'payout' => '/v2/payouts/create',

        /**
         * Collection reconcilliation endpoint
         *
         * The endpoint used for collection reconcilliation
         */
        'collection_reconcilliation' => '/v2/reconciliation/collection',

        /**
         * Payout reconcilliation endpoint
         *
         * The endpoint used for payout reconcilliation
         */
        'payout_reconcilliation' => '/v2/reconciliation/payout',
    ],

    /**
     * Default heades sent to M-Lipa
     */
    'default_headers' => [
        /**
         * Accept application/json response from M-Lipa
         */
        'Accept' => 'application/json',

        /**
         * The content type we are sending is application/json
         */
        'Content-Type' => 'application/json',
    ],
];
```

Authentication
--------------

[](#authentication)

The package uses Oauth2, go to [M-Lipa Dashboard](https://developer.mlipa.co.tz/), then generate client secret and client key. Then update the variables in your .env file accordingly.

```
MLIPA_CLIENT_KEY="9a2db4c7-3e98-**************"
MLIPA_CLIENT_SECRET="XeGdmOzj34E2eNZfmQY6Q**************"
```

Usage
-----

[](#usage)

### Initiate Push USSD collection

[](#initiate-push-ussd-collection)

```
$response = Mlipa::initiatePushUssd(
    amount: 450000,
    msisdn: "255754881199"
);
```

### Initiate billing collection

[](#initiate-billing-collection)

```
$response = Mlipa::initiateBilling(
    amount: 450000,
    msisdn: "255754881199"
);
```

### Initiate payout

[](#initiate-payout)

```
$response = Mlipa::initiatePayout(
    amount: 450000,
    msisdn: "255754881199",
    name: "John Doe"
);
```

### Reconcile Collection

[](#reconcile-collection)

```
$response = Mlipa::reconcileCollection(
    reference: "28199122321",
);
```

### Reconcile Payout

[](#reconcile-payout)

```
$response = Mlipa::reconcilePayout(
    reference: "28199122321",
);
```

### Custom verification flow

[](#custom-verification-flow)

By default verification will turn true. In order to customise in you service provider's boot method implement a callback that returns true. Otherwise, whether nothing is returned or falsy values, the verification will fail. If you have disabled payout models, then $isTransactionValid will be true by default, if the model is defined, then the reference will be checked against the payout, if it exists, then $isTransactionValid will be true, if doesn't $isTransactionValid will be false.

```
Mlipa::verifyPayoutUsing(function(string $reference, bool $isTransactionValid): bool{
     // some code to verify the transaction
     return $isTransactionValid;
});
```

### Webhook Events

[](#webhook-events)

You can subscribe to webhook events, and use callbacks by subscribing to events. You can subscribe to events in your EventServiceProvider

```
protected $listen = [
   BillingFailed::class => [
        MyListener::class
   ],
   BillingSuccess::class => [
        MyListener::class
   ],
   PushUssdFailed::class => [
        MyListener::class
   ],
   PushUssdSuccess::class => [
        MyListener::class
   ],
   PayoutSuccess::class => [
        MyListener::class
   ],
   PayoutFailed::class => [
        MyListener::class
   ]
];
```

  Event Property Type Description   BillingFailed $data DatavisionInt\\Mlipa\\MlipaWebhookEventData An object containing webhook data as in the documentation   $collection DatavisionInt\\Mlipa\\Models\\MlipaCollection|null|{The model you define in config} The collection model instance, will be null if set to null in config, or the model that you define in the config   BillingSuccess $data DatavisionInt\\Mlipa\\MlipaWebhookEventData An object containing webhook data as in the documentation   $collection DatavisionInt\\Mlipa\\Models\\MlipaCollection|null|{The model you define in config} The collection model instance, will be null if set to null in config, or the model that you define in the config   PushUssdFailed $data DatavisionInt\\Mlipa\\MlipaWebhookEventData An object containing webhook data as in the documentation   $collection DatavisionInt\\Mlipa\\Models\\MlipaCollection|null|{The model you define in config} The collection model instance, will be null if set to null in config, or the model that you define in the config   PushUssdSuccess $data DatavisionInt\\Mlipa\\MlipaWebhookEventData An object containing webhook data as in the documentation   $collection DatavisionInt\\Mlipa\\Models\\MlipaCollection|null|{The model you define in config} The collection model instance, will be null if set to null in config, or the model that you define in the config   PayoutSuccess $data DatavisionInt\\Mlipa\\MlipaWebhookEventData An object containing webhook data as in the documentation   $payout DatavisionInt\\Mlipa\\Models\\MlipaPayout|null|{The model you define in config} The payout model instance, will be null if set to null in config, or the model that you define in the config   PayoutFailed $data DatavisionInt\\Mlipa\\MlipaWebhookEventData An object containing webhook data as in the documentation   $payout DatavisionInt\\Mlipa\\Models\\MlipaPayout|null|{The model you define in config} The payout model instance, will be null if set to null in config, or the model that you define in the config

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance54

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

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

Every ~59 days

Recently: every ~163 days

Total

12

Last Release

309d ago

Major Versions

0.0.1 → 1.0.12023-09-21

PHP version history (2 changes)0.0.1PHP ^8.1

1.1.4PHP ^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/07a006944fcfb1f6343091863ac4f2415076ffba9f9e076a88c0991bc3d97bf0?d=identicon)[datavisionint](/maintainers/datavisionint)

---

Top Contributors

[![mwakalingajohn](https://avatars.githubusercontent.com/u/14811728?v=4)](https://github.com/mwakalingajohn "mwakalingajohn (86 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laraveldatavisionintlaravel-mlipamlipa

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[danestves/laravel-polar

A package to easily integrate your Laravel application with Polar.sh

7812.3k](/packages/danestves-laravel-polar)[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)[creagia/laravel-redsys

Laravel Redsys Payments Gateway

2013.6k](/packages/creagia-laravel-redsys)

PHPackages © 2026

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