Overview

PHP M-Pesa SDK Documentation

Welcome to the PHP M-Pesa SDK Documentation! This comprehensive SDK provides a modern, type-safe interface for integrating M-Pesa payment services into your PHP applications in Ethiopia.

Overview

The PHP M-Pesa SDK offers a robust and developer-friendly way to interact with M-Pesa's payment gateway. Built with modern PHP practices and designed with a fluent interface, it simplifies the integration of M-Pesa services while ensuring type safety and proper error handling.

Key Features

  • STK Push Integration: Easily implement M-Pesa's STK Push functionality
  • B2C Operations: Handle Business-to-Customer transactions seamlessly
  • C2B Capabilities: Process Customer-to-Business payments with validation
  • Transaction Status Queries: Monitor and track payment statuses
  • URL Registration: Automated handling of confirmation and validation URLs
  • Account Balance Queries: Check your M-Pesa account balance
  • Type-Safe Responses: All responses are properly typed for better reliability
  • Fluent Interface: Modern, chainable methods for better code readability
  • Comprehensive Error Handling: Robust error handling with custom exceptions
  • Extensive Testing: Well-tested codebase ensuring stability

Prerequisites

  • PHP 7.4 or higher
  • Composer
  • GuzzleHTTP 7.0 or higher
  • PHP extensions: curl, json
  • Valid M-Pesa API credentials (Consumer Key and Secret)
  • Internet connectivity