Download the PHP package mossey/mpesa without Composer

On this page you can find all versions of the php package mossey/mpesa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mpesa

This package has been abandoned please use https://github.com/safaricom/mpesa-php-sdk

Introduction

This package seeks to help php developers implement the various Mpesa APIs without much hustle. It is based on the REST API whose documentation is available on http://developer.safaricom.co.ke.

Installation using composer
composer require mossey/mpesa

Configuration
At your project root, create a .env file and in it set the consumer key and consumer secret as follows
consumer_key= [consumer key]
consumer_secret=[consumer secret]
For Laravel users, open the Config/App.php file and add \Mossey\Mpesa\MpesaServiceProvider::class under providers and 'Mpesa'=> \Mossey\Mpesa\MpesaServiceProvider::class under aliases.

Usage

Confirmation and validation urls

B2C Payment Request

This creates transaction between an M-Pesa short code to a phone number registered on M-Pesa.

$mpesa= new \Mossey\Mpesa\Mpesa();

$b2cTransaction=$mpesa->b2c( $ShortCode, $CommandID, $Amount, $Msisdn, $BillRefNumber );

Account Balance Request

This is used to enquire the balance on an M-Pesa BuyGoods (Till Number)

$mpesa= new \Mossey\Mpesa\Mpesa();

$balanceInquiry=$mpesa->accountBalance($CommandID, $Initiator, $SecurityCredential, $PartyA, $IdentifierType, $Remarks, $QueueTimeOutURL, $ResultURL);

Transaction Status Request This is used to check the status of transaction.

$mpesa= new \Mossey\Mpesa\Mpesa();

$trasactionStatus=$mpesa->transactionStatus($Initiator, $SecurityCredential, $CommandID, $TransactionID, $PartyA, $IdentifierType, $ResultURL, $QueueTimeOutURL, $Remarks, $Occasion);

B2B Payment Request

This is used to transfer funds between two companies.

$mpesa= new \Mossey\Mpesa\Mpesa();

$b2bTransaction=$mpesa->b2b($ShortCode, $CommandID, $Amount, $Msisdn, $BillRefNumber );

STK Push Simulation

This is used to initiate online payment on behalf of a customer.

$mpesa= new \Mossey\Mpesa\Mpesa();

$stkPushSimulation=$mpesa->STKPushSimulation($BusinessShortCode, $LipaNaMpesaPasskey, $TransactionType, $Amount, $PartyA, $PartyB, $PhoneNumber, $CallBackURL, $AccountReference, $TransactionDesc, $Remarks);

STK Push Status Query

This is used to check the status of a Lipa Na M-Pesa Online Payment.

$mpesa= new \Mossey\Mpesa\Mpesa();

$STKPushRequestStatus=$mpesa->STKPushQuery($checkoutRequestID,$businessShortCode,$password,$timestamp);

Confirmation and Validation

These are required in order to complete most of the transaction. Without these the transactions won't be complete. Therefore, register your URLS in the developer portal and soon as you're done be sure to ensure your validation URL and confirmation URL contain the following.

Validation

$mpesa= new \Mossey\Mpesa\Mpesa();

$b2bTransaction=$mpesa->validate();

Confirmation

$mpesa= new \Mossey\Mpesa\Mpesa();

$b2bTransaction=$mpesa->confirm();


All versions of mpesa with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mossey/mpesa contains the following files

Loading the files please wait ....