Giter VIP home page Giter VIP logo

mpesa's Introduction

Mpesa API Implementation

Latest Stable Version Total Downloads Latest Unstable Version License

This package is created to integrate MPesa Services i.e. C2B, B2C, B2B and Online Checkout in your Laravel app. It allows you to receive and process soap sent by Safaricom. The package is still under heavy development and thus subject to bugs and changes.

Requirements

Quick Installation

composer require "lawrence615/mpesa:dev-master"

Service Provider

Mobidev\Mpesa\MpesaServiceProvider::class

Configuration and Assets

php artisan vendor:publish --provider="Mobidev\Mpesa\MpesaServiceProvider"

Then run php artisan migrate to create the tables in you database. This will create two tables;

  1. mpesa_payment_logs table - logs everything received from Safaricom

  2. payments table - breaks down what is received from Safaricom into a number of columns

Receiver Route

The route that receives the IPN is c2b/payments/receiver i.e. http://example.com/c2b/payments/receiver. This is the endpoint you give to Safaricom.

Events

There are events triggered when certain actions happen. You can extend the package's behaviour by setting up your own event listeners to provide custom functionality.

These are the events triggered by the package. The list will grow with time as more events come up;

Event Available data
c2b.received.payment Full C2B Payment Object

C2B Payment Event Listener

Create a Controller i.e. PaymentsController then create a function c2bPayment

    //$payload will have the data from the event
    public function c2bPayment($payload){
       
    }

Register an event listener in the boot method of your EventServiceProvider:

Event::listen('c2b.received.payment', 'App\Http\Controllers\PaymentsController@c2bPayment');

mpesa's People

Contributors

lawrence615 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.