Logo Lanfrica
  • Home
  • Atlas
  • Insights
  • Docs
  • Sign in

© 2026 Lanfrica. All rights reserved. All copyrights of the resources shown on the Lanfrica website belong to the original copyright holders, unless explicitly stated otherwise.

Francis-Yuppie/mpesa-API

Domain:

digital infrastructure

Record type:

software
Creator:
Fra
Host:
**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 developer.safaricom.co.ke. **Installation using composer** `composer require safaricom/mpesa` **Configuration** At your project root, create a .env file and in it set the consumer key and consumer secret as follows `MPESA_CONSUMER_KEY= [consumer key]` `MPESA_CONSUMER_SECRET=[consumer secret]` `MPESA_ENV=[live or sandbox]` For Laravel users, open the Config/App.php file and add `\Safaricom\Mpesa\MpesaServiceProvider::class` under providers and ` 'Mpesa'=> \Safaricom\Mpesa\MpesaServiceProvider::class` under aliases. _Remember to edit the consumer_key and consumer_secret values appropriately when switching between sandbox and live_ **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 \Safaricom\Mpesa\Mpesa();` `$b2cTransaction=$mpesa->b2c($InitiatorName, $SecurityCredential, $CommandID, $Amount, $PartyA, $PartyB, $Remarks, $QueueTimeOutURL, $ResultURL, $Occasion);` **Account Balance Request** This is used to enquire the balance on an M-Pesa BuyGoods (Till Number) `$mpesa= new \Safaricom\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 \Safaricom\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 \Safaricom\Mpesa\Mpesa();` `$b2bTransaction=$mpesa->b2b($ShortCode, $CommandID, $Amount, $Msisdn, …

Visit

github.com

Languages

Lusengo

Similar

icrackthecode/MPESA-APIngecu/Mpesa-APIbmcouma/MPESA-APIwilliwambu/mpesa-apikevmongare/mpesa-apivictorpreston/mpesa-api

icrackthecode/MPESA-API

PHP implementation of MPESA checkout API. Simple for even the non techies. # MPESA-API PHP impleme

ngecu/Mpesa-API

A powerful solution for integrating Safaricom's M-Pesa services into your Node.js applications. This

bmcouma/MPESA-API

# Mpesa_API ## **PLP Academy Practice** # Mpesa Daraja API Integration with Django This guide pro

williwambu/mpesa-api

An unofficial implementation of mpesa api # mpesa-api An unofficial implementation of mpesa api

kevmongare/mpesa-api

A Node.js implementation of the Safaricom M-Pesa Daraja API — including STK Push, C2B, B2C, and Tran

victorpreston/mpesa-api

Safaricom daraja 3.0 java (SpringBoot) api integrations (sdk) - STK Push, C2B, B2C, B2B, Transacti