PHPackages                             shiftechafrica/pam-php-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. shiftechafrica/pam-php-sdk

ActiveLibrary[API Development](/categories/api)

shiftechafrica/pam-php-sdk
==========================

This library handles all the PAM - PayBill Account Manager API's,that are then linked to Safaricom M-pesa Daraja.

v1.4.9(1y ago)46331MITPHP

Since Nov 11Pushed 1y agoCompare

[ Source](https://github.com/SHIFTECH-AFRICA/pam-php-sdk)[ Packagist](https://packagist.org/packages/shiftechafrica/pam-php-sdk)[ RSS](/packages/shiftechafrica-pam-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (23)Used By (0)

[![](https://camo.githubusercontent.com/f25247a6b9b10066ad1894fa80594a4e09f58209feb5e82c32f2ca677bdc6aba/68747470733a2f2f70616d2e656173796e637061792e636f6d2f696d672f6c6f676f2e706e67)](https://pam.easyncpay.com)

[](#)

 **Easy Money Manager**
 [ ![](https://camo.githubusercontent.com/76bdf35975321b747659416d9f7bacbf428854ec0db413adccbfed2faeb22b44/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f53484946544543482d4146524943412f70616d2d7068702d73646b2e737667) ](https://github.com/SHIFTECH-AFRICA/pam-php-sdk/issues) [ ![](https://camo.githubusercontent.com/24aeaf300460de664b1f1cb29773d6f92428c0280c09ba10a7e8acfa8ddb8400/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f53484946544543482d4146524943412f70616d2d7068702d73646b2e737667) ](https://github.com/SHIFTECH-AFRICA/pam-php-sdk/network/members) [ ![](https://camo.githubusercontent.com/aadedb32cc99f613cdab0c7ec297fc3921cc92225ad46c0e5679c565392559c5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f53484946544543482d4146524943412f70616d2d7068702d73646b2e737667) ](https://github.com/SHIFTECH-AFRICA/pam-php-sdk/stargazers) [ ![](https://camo.githubusercontent.com/2dcc17b45c4a276b4d23f0f304a957d2c3ad939284f5145276baab517bf42f8e/68747470733a2f2f706f7365722e707567782e6f72672f73686966746563686166726963612f70616d2d7068702d73646b2f762f737461626c65) ](https://packagist.org/packages/shiftechafrica/pam-php-sdk) [ ![](https://camo.githubusercontent.com/077917d2cad5f418a0f2c191f04155f27c972148747b7274a5ffa79b1e026019/68747470733a2f2f706f7365722e707567782e6f72672f73686966746563686166726963612f70616d2d7068702d73646b2f646f776e6c6f616473) ](https://packagist.org/packages/shiftechafrica/pam-php-sdk)

 [![](https://github.com/dev-techguy/TechGuy/raw/master/doc.png)](https://pam.easyncpay.com/docs)

Introduction
------------

[](#introduction)

This library handles all the PAM - PayBill Account Manager API's,that are then linked to Safaricom M-pesa Portals.

Installing
----------

[](#installing)

The recommended way to install pam-php-sdk is through [Composer](http://getcomposer.org).

```
# Install package via composer
composer require shiftechafrica/pam-php-sdk
```

Next, run the Composer command to install the latest stable version of *shiftechafrica/pam-php-sdk*:

```
# Update package via composer
 composer update shiftechafrica/pam-php-sdk --lock
```

After installing, the package will be auto discovered, But if need you may run:

```
# run for auto discovery
composer dump-autoload
```

Then run this, to get the *config/pam.php* for your own configurations:

```
# run this to get the configuration file at config/pam.php
php artisan vendor:publish --provider="PAM\PAMServiceProvider"
```

A *config/.php* file will be created, follow the example below to define your own configurations.

```
# set your account secret key api token
PAM_API_TOKEN=check_on_api_profile
PAM_APP_SHORTCODE_SECRET_KEY=check_on_the_app_pay_bill
```

Usage
-----

[](#usage)

Follow the steps below on how to use the pam-php-sdk:

#### How to use the Library

[](#how-to-use-the-library)

How to use the pam-php-sdk to initiate different levels of *api's*

```
        use PAM\API\B2C;
        use PAM\API\PayLoad;
        use PAM\API\RegC2bUrl;
        use PAM\API\ShortCode;
        use PAM\API\App;
        use PAM\API\STKPush;
        use PAM\API\Balance;

        /**
         * Fetch all your shortcodes
         */
        (new ShortCode())->index();

        /**
         * Get details of one shortcode
         * by passing the id
         */
        (new ShortCode())->show('id');

        /**
         * Fetch all your apps
         */
        (new App())->index();

        /**
         * Get details of one app
         * by passing the id
         */
        (new App())->show('id');

        /**
         * Fetch max index();

        /**
         * Get details of one payload
         * by passing the id
         */
        (new PayLoad())->show('id');

        /**
         * get the validate shortcode
         * @return mixed
         */
        (new ShortCode())->validate([
            "ConsumerKey" => "",
            "ConsumerSecret" => "",
            "Environment" => "" // sandbox or production
        ]);

        /**
         * get the initiate stk
         * push
         * @return mixed
         */
        (new STKPush())->initiateSTK([
            "CallingCode" => "", // 254 or 255
            "Secret" => "",
            "TransactionType" => "", // CustomerPayBillOnline or CustomerBuyGoodsOnline
            "PhoneNumber" => "",
            "Amount" => "",
            "ResultUrl" => "",
            "Description" => ""
        ]);

        /**
         * register c2b url for lipa_na_mpesa
         * @return JsonResponse|mixed
         */
        (new RegC2bUrl())->registerC2BURL([
            "Secret" => ""
        ]);

        /**
         * check paybill/till balance
         * @return JsonResponse|mixed
         */
        (new Balance())->checkBalance([
            "Secret" => ""
        ]);

        /**
         * process the b2c transaction
         * here
         * @return mixed
         */
        (new B2C())->initiateB2C([
            "CallingCode" => "", // 254 or 255
            "Secret" => "",
            "TransactionType" => "", // SalaryPayment or BusinessPayment or PromotionPayment
            "PhoneNumber" => "",
            "Amount" => "",
            "ResultUrl" => "",
            "Description" => ""
        ]);

        /**
         * process the stk payment confirmation
         * here
         * @return mixed
         */
        return (new ConfirmPayment())->stkPayment([
            "Secret" => "",// secret for handling stk transactions
            "ReferenceNumber" => "", // the transaction number used for initiating the payment.
            "ResultUrl" => "", // url to receive the payment status
        ]);

            /**
             * process the withdrawal confirmation
             * here
             * @return mixed
             */
            return (new ConfirmPayment())->withdrawPayment([
                "Secret" => "", // secret for handling b2c transactions
                "ReferenceNumber" => "", // the transaction number used for initiating the payment.
                "ResultUrl" => "", // url to receive the payment status
            ]);
```

API Responses
-------------

[](#api-responses)

These are the responses that one expects from each api requests.

### PayBill/ShortCode Credentials Validation

[](#paybillshortcode-credentials-validation)

```
   # Sample 200 response
    "data": {
        "Message": "The m-pesa app keys are valid."
    },
    "success": true
```

### Register C2B URL (confirm/validation)

[](#register-c2b-url-confirmvalidation)

```
     # Sample 200 response
    "data": {
        "Message": "Validation and Confirmation URLs are already registered"
    },
    "success": true
```

### Balance Response

[](#balance-response)

```
     # Sample 200 response
    "data": {
        "Number": XXXXX,
        "Balance": 38,000.00
    },
    "success": true
```

### STK-PUSH/C2B LIPA NA M-PESA

[](#stk-pushc2b-lipa-na-m-pesa)

```
    # This the response for making a successful request
    "data": {
        "Message": "Request accepted for processing...",
        "ReferenceNumber": "2BONOSBBTN"
    }
    "success": true

    # stk successful payment done.
    "data": {
        "Success": true,
        "Description": "The service request is processed successfully.",
        "ReferenceNumber": "2BONOSBBTN",
        "PhoneNumber": "254XXXXXXXXX",
        "MpesaReceiptNumber": "PBO2ZOBY44",
        "Amount": 20000
    }

    # c2b/lipa na mpesa successful payment done.
    "data": {
        "Success": true,
        "Description": "The service request is processed successfully.",
        "ReferenceNumber": "2BONOSBBTN",
        "PhoneNumber": "254XXXXXXXXX",
        "MpesaReceiptNumber": "PBO2ZOBY44",
        "Amount": 20000,
        'TransactionType': 'Pay Bill'
        'OrgAccountBalance': 50000,
        'ShortCode':xxxxxx
    }

    # stk/c2b payment not done
    "data": {
        "Success": false,
        "Description": "Request cancelled by user",
        "ReferenceNumber": "2BOXRDNMLU",
        "PhoneNumber": "254XXXXXXXXX"
    }

    # This the response for checking stk push payment - similar to mpesa stk push query
    "data": {
        "Message": "Accepted for processing..."
    }
    "success": true

    # stk push payment confirmation callback...
    "data": {
        "Success": true or false,
        "Description": "The service request is processed successfully.",
        "ReferenceNumber": "2BONOSBBTN",
        "PhoneNumber": "254XXXXXXXXX",
        "MpesaReceiptNumber": "PBO2ZOBY44",
        "Amount": 20000
    }
```

### B2C/BULK PAYMENT

[](#b2cbulk-payment)

```
    # This the response for making a successful request
    "data": {
        "Message": "Request accepted for processing...",
        "ReferenceNumber": "2BO6BCTLYF"
    },
    "success": true

    # b2c successful withdraw payment done.
    "data": {
       'Success' => true,
       'Description' => 'Salary payment',
       'ReferenceNumber' => '2BO6BCTLYF',
       'PhoneNumber' => '254XXXXXXXXX',
       'MpesaReceiptNumber' => 'PBO2ZOBY44',
       'Amount' => 50000,
       'B2CUtilityAccountAvailableFunds' => 70000,
       'B2CWorkingAccountAvailableFunds' => 70000,
       'B2CChargesPaidAccountAvailableFunds' => 70000
    }

    # b2c withdraw payment not done.
    "data": {
        "Success": false,
        "Description": "The initiator information is invalid.",
        "ReferenceNumber": "2BO6BCTLYF",
        "PhoneNumber": "254XXXXXXXXX"
    }

    # This the response for checking withdrawal payment
    "data": {
        "Message": "Accepted for processing..."
    }
    "success": true

    # withdrawal payment confirmation callback...
    "data": {
       'Success' => true or false,
       'Description' => 'Salary payment',
       'ReferenceNumber' => '2BO6BCTLYF',
       'PhoneNumber' => '254XXXXXXXXX',
       'MpesaReceiptNumber' => 'PBO2ZOBY44',
       'Amount' => 50000,
       'B2CUtilityAccountAvailableFunds' => 70000,
       'B2CWorkingAccountAvailableFunds' => 70000,
       'B2CChargesPaidAccountAvailableFunds' => 70000
    }
```

Version Guidance
----------------

[](#version-guidance)

VersionStatusPackagistNamespaceRepo1.xLatest`shiftechafrica/pam-php-sdk``PAM`[v1.4.9](https://github.com/SHIFTECH-AFRICA/pam-php-sdk/releases/tag/v1.4.9)Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

For any security vulnerabilities, please email to [Shiftech Africa](mailto:bugs@shiftech.co.ke).

License
-------

[](#license)

This package is open-source, licensed under the [MIT License](https://opensource.org/licenses/MIT).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 82.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~74 days

Recently: every ~223 days

Total

21

Last Release

520d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a666611c24d993ba2d2326c1d0e7dbf772a0b1d89c6da6bdecd5537b58644f2?d=identicon)[shiftechafrica](/maintainers/shiftechafrica)

---

Top Contributors

[![general-oisebe](https://avatars.githubusercontent.com/u/154009443?v=4)](https://github.com/general-oisebe "general-oisebe (38 commits)")[![dev-techguy](https://avatars.githubusercontent.com/u/36882600?v=4)](https://github.com/dev-techguy "dev-techguy (8 commits)")

---

Tags

account-managementapidaraja-apieasyncypayfintechmpesapampaybillsafaricomshiftechafricaapiB2Cm-pesac2bpaybill account managerpamstk-pushlipa-na-mpesafintech solution

### Embed Badge

![Health badge](/badges/shiftechafrica-pam-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/shiftechafrica-pam-php-sdk/health.svg)](https://phpackages.com/packages/shiftechafrica-pam-php-sdk)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.8M2](/packages/get-stream-stream-chat)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
