PHPackages                             emleons/pesapal-php - 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. [Payment Processing](/categories/payments)
4. /
5. emleons/pesapal-php

ActiveLibrary[Payment Processing](/categories/payments)

emleons/pesapal-php
===================

General-purpose Pesapal PHP integration library — Easily authenticate, create payment orders, handle IPNs, and check transaction status with minimal setup.

v1.0.0(9mo ago)02MITPHP

Since Aug 11Pushed 8mo agoCompare

[ Source](https://github.com/emleonstz/pesapal-php)[ Packagist](https://packagist.org/packages/emleons/pesapal-php)[ RSS](/packages/emleons-pesapal-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Pesapal PHP SDK
===============

[](#pesapal-php-sdk)

[![Latest Version](https://camo.githubusercontent.com/2b93078deef03221385659e59db6a086c1f426f5d97a9092bf8ff08269507adc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656d6c656f6e732f7065736170616c2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/emleons/pesapal-php)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/37457ce12d2447638ad1349092b66bf8b7d6bd0c37aae95f3f2ee336d8e1f8d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f656d6c656f6e732f7065736170616c2d7068702e7376673f7374796c653d666c61742d737175617265)](https://php.net)

> **Please Check the Official Pesapal API Documentation**:

A modern PHP wrapper for the Pesapal v3 API, providing easy integration with Pesapal's payment services. This SDK implements all core API endpoints with PHP best practices.

Features
--------

[](#features)

- **Complete API Coverage**: All essential [Pesapal API v3 endpoints](https://developer.pesapal.com/api3-docs) implemented
- **Automatic Token Handling**: OAuth tokens managed automatically
- **Sandbox Support**: Built-in sandbox mode for testing
- **Strict Typing**: PHP 7.4+ type declarations for reliability
- **PSR Standards**: Works with most php FrameWork Laravel, Codeigniter 4, Symfony ..

Installation
------------

[](#installation)

```
composer require emleons/pesapal-php
```

Basic Usage
-----------

[](#basic-usage)

```
use Emleons\PesapalPhp\Pesa;

$pesa = new Pesa([
    'consumer_key'    => 'your_key_here',
    'consumer_secret' => 'your_secret_here',
    'is_sandbox'      => true // Set false for production
]);

// Register IPN URL (GET or POST)
$ipnResponse = $pesa->registerIpnUrl(
    'https://yourdomain.com/ipn',
    'POST'
);

// Submit payment
$payment = $pesa->makeThePayment(
    [
    "id" => $randomString,
    "currency" => "TZS",
    "amount" => 10000.00,
    "description" => "Payment description goes here",
    "callback_url" => "http://localhost:8080/pesapal/pin.php",
    "redirect_mode" => "",
    "notification_id" => "030bf9b0-a5d7-4cbd-b5cb-dbb88f03b75e",
    "branch" => "Store Name - HQ",
    "billing_address" => [
        "email_address" => "john.doe@example.com",
        "phone_number" => "0723xxxxxx",
        "country_code" => "KE",
        "first_name" => "John",
        "middle_name" => "",
        "last_name" => "Doe",
        "line_1" => "Pesapal Limited",
        "line_2" => "",
        "city" => "",
        "state" => "",
        "postal_code" => "",
        "zip_code" => ""
    ]
]
);

// Get More Methods from Pesa class
```

Official API Reference
----------------------

[](#official-api-reference)

For complete API specifications and required parameters, always refer to the: 👉 [Official Pesapal API Documentation](https://developer.pesapal.com/api3-docs)

Particularly useful sections:

- [Authentication](https://developer.pesapal.com/how-to-integrate/e-commerce/api-30-json/authentication)
- [IPN Registration](https://developer.pesapal.com/how-to-integrate/e-commerce/api-30-json/registeripnurl)
- [Order Submission](https://developer.pesapal.com/how-to-integrate/e-commerce/api-30-json/submitorderrequest)
- [Status Checking](https://developer.pesapal.com/how-to-integrate/e-commerce/api-30-json/gettransactionstatus)

Testing with Sandbox
--------------------

[](#testing-with-sandbox)

1. Get sandbox credentials from [Pesapal Developer Portal](https://developer.pesapal.com/)
2. Set `is_sandbox => true`

Security Notice
---------------

[](#security-notice)

Always:

- Validate all user inputs before API calls
- Use HTTPS for all callbacks
- Regularly check [Pesapal's security advisories](https://www.pesapal.com/security)

---

This unofficial SDK is maintained by [emleonstz](https://github.com/emleonstz) as an open source project.
Pesapal is not responsible for this implementation.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance58

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

281d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b331e86b72def00f61cf1913a0b6bb99d2ebeb4e61cdacfe7c436e6ea9d9b7bb?d=identicon)[EmLeons](/maintainers/EmLeons)

---

Top Contributors

[![emleonstz](https://avatars.githubusercontent.com/u/64161260?v=4)](https://github.com/emleonstz "emleonstz (3 commits)")

---

Tags

intergrationpayment-gatewaypesapaltanzania-payment

### Embed Badge

![Health badge](/badges/emleons-pesapal-php/health.svg)

```
[![Health](https://phpackages.com/badges/emleons-pesapal-php/health.svg)](https://phpackages.com/packages/emleons-pesapal-php)
```

###  Alternatives

[chargebee/chargebee-php

ChargeBee API client implementation for PHP

768.0M9](/packages/chargebee-chargebee-php)[imdhemy/google-play-billing

Google Play Billing

491.3M5](/packages/imdhemy-google-play-billing)[bitpay/sdk

Complete version of the PHP library for the new cryptographically secure BitPay API

42337.5k4](/packages/bitpay-sdk)[buckaroo/sdk

Buckaroo payment SDK

12189.1k9](/packages/buckaroo-sdk)[contica/facturador-electronico-cr

Un facturador de código libre para integrar facturación electrónica en Costa Rica a un proyecto PHP

2128.8k](/packages/contica-facturador-electronico-cr)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)

PHPackages © 2026

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