2017 © Pedro Peláez
 

library mpesac2b

Package to integrate Mpesa C2B Service

image

ftg/mpesac2b

Package to integrate Mpesa C2B Service

  • Tuesday, April 11, 2017
  • by FluidTechGlobal
  • Repository
  • 0 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Mpesa c2b

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Build up upon from https://packagist.org/packages/lawrence615/mpesa, (*2)

This package is created to integrate c2b Mpesa. This package will only take payments payed by users in the system., (*3)

Requirements

Quick Installation

composer require "ftg/mpesac2b:dev-master"

Service Provider

Ftg\Mpesa\MpesaServiceProvider::class,

Configuration and Assets

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

Then run php artisan migrate to create the tables in you database. This will create two tables;, (*4)

  1. mpesa_payment_logs table - logs everything received from Safaricom, (*5)

  2. payments table - breaks down what is received from Safaricom into a number of columns, (*6)

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., (*7)

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., (*8)

These are the events triggered by the package. The list will grow with time as more events come up;, (*9)

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

C2B Payment Event Listener, (*10)

Add the following to the .env, (*11)

BusinessNumber=
MaxAmount=

Create a Controller i.e. PaymentsController then create a function c2bPayment, (*12)

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

    }

Register an event listener in the boot method of your EventServiceProvider:, (*13)

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

The Versions

11/04 2017

dev-master

9999999-dev

Package to integrate Mpesa C2B Service

  Sources   Download

MIT

The Requires