PHPackages                             ssiva/mpesa-lumen-sdk - 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. [API Development](/categories/api)
4. /
5. ssiva/mpesa-lumen-sdk

ActiveLibrary[API Development](/categories/api)

ssiva/mpesa-lumen-sdk
=====================

This package provides a seamless integration of M-PESA Daraja APIs in Lumen applications

v1.1.3(3y ago)07MITPHP

Since Apr 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ssiva13/mpesa-lumen-sdk)[ Packagist](https://packagist.org/packages/ssiva/mpesa-lumen-sdk)[ RSS](/packages/ssiva-mpesa-lumen-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

LUMEN MICRO-FRAMEWORK MPESA DARAJA SDK
--------------------------------------

[](#lumen-micro-framework-mpesa-daraja-sdk)

This package provides a seamless integration of M-PESA Daraja APIs in Lumen applications, allowing developers to easily handle:

- B2C (Business to Customer)
- C2B (Customer to Business)
- B2B (Business to Business)
- Account Balance inquiries
- Transaction reversals queries
- Transaction status queries.

It simplifies the implementation process by providing an intuitive interface for making API requests, handling responses, and managing errors. With this package, developers can seamlessly integrate M-PESA Daraja APIs in their Lumen projects, saving time and effort.

### Installation and Setup

[](#installation-and-setup)

1. Run the command below

    ```
    composer require ssiva/mpesa-lumen-sdk

    ```
2. Open your bootstrap/app.php and make the following changes:

    - uncomment and edit the following line

        ```
         // $app->withFacades();
        ```

        to

        ```
        $app->withFacades(true, [
        \Ssiva\MpesaLumenSdk\MpesaFacade::class => 'MpesaDaraja',
        ]);
        ```
    - Register the Mpesa ServiceProvider

        ```
         // Mpesa ServiceProvider
         $app->register(\Ssiva\MpesaLumenSdk\MpesaServiceProvider::class);
        ```

### Configuration

[](#configuration)

Set up the config values as required

1. Account API Online Config

    ```
         MPESA_SHORTCODE=
         MPESA_RESULT_URL=
         MPESA_TIMEOUT_URL=
         MPESA_INITIATOR_NAME=
         MPESA_SECURITY_CREDENTIAL=
         MPESA_SECURITY_CERT=
         MPESA_ACCOUNT_IDENTIFIER=
    ```
2. LipaNaMpesa API Online Config

    ```
         MPESA_SHORTCODE=
         MPESA_CALLBACK_URL=
         MPESA_PASSKEY=
         MPESA_ONLINE_TRANSACTION_TYPE=
    ```
3. B2C API Config

    ```
         MPESA_SHORTCODE=
         MPESA_RESULT_URL=
         MPESA_TIMEOUT_URL=
         MPESA_INITIATOR_NAME=
         MPESA_SECURITY_CREDENTIAL=
         MPESA_SECURITY_CERT=
         MPESA_ACCOUNT_IDENTIFIER=
         MPESA_B2C_COMMAND=
    ```
4. B2B API Config

    ```
         MPESA_SHORTCODE=
         MPESA_RESULT_URL=
         MPESA_TIMEOUT_URL=
         MPESA_INITIATOR_NAME=
         MPESA_SECURITY_CREDENTIAL=
         MPESA_SECURITY_CERT=
         MPESA_ACCOUNT_IDENTIFIER=
         MPESA_B2B_COMMAND=
         MPESA_B2B_SENDER_ID=
         MPESA_B2B_RECEIVER_ID=
    ```
5. C2B API Config

    ```
         MPESA_SHORTCODE=
         MPESA_C2B_COMMAND=
         MPESA_C2B_CONFIRMATION_URL=
         MPESA_C2B_VALIDATION_URL=
         MPESA_C2B_RESPONSE_TYPE=
    ```

### Usage Examples

[](#usage-examples)

```
