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

ActiveLibrary[Payment Processing](/categories/payments)

shwary/php-sdk
==============

SDK PHP officiel pour l'API marchande Shwary - Paiements Mobile Money (RDC, Kenya, Ouganda)

v1.0.2(4mo ago)9606↑133.3%1MITPHPPHP ^8.2CI passing

Since Jan 21Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/Tresor-Kasenda/shwary-php-sdk)[ Packagist](https://packagist.org/packages/shwary/php-sdk)[ Docs](https://github.com/Tresor-Kasenda/shwary-php-sdk)[ RSS](/packages/shwary-php-sdk/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (6)Versions (3)Used By (0)

Shwary PHP SDK
==============

[](#shwary-php-sdk)

[![PHP Version](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)](https://php.net)[![License](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](LICENSE)[![PHPStan](https://camo.githubusercontent.com/14995ff65edea59395c224e37e4fc66f91c1e601c1a58311e3c6f38c4fe37feb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c2532306d61782d627269676874677265656e)](https://phpstan.org/)

Official PHP SDK for the Shwary API - Mobile Money Payments for DRC, Kenya, and Uganda.

---

📋 Table of Contents
-------------------

[](#-table-of-contents)

- [Introduction](#-introduction)
- [Requirements](#-requirements)
- [Installation](#-installation)
- [Configuration](#-configuration)
- [Quick Start Guide](#-quick-start-guide)
- [Detailed Usage](#-detailed-usage)
- [Handling Webhooks](#-handling-webhooks)
- [Sandbox Mode (Testing)](#-sandbox-mode-testing)
- [Error Handling](#-error-handling)
- [Laravel Integration](#-laravel-integration)
- [Complete Reference](#-complete-reference)
- [FAQ &amp; Troubleshooting](#-faq--troubleshooting)
- [Contributing](#-contributing)

---

🎯 Introduction
--------------

[](#-introduction)

### What is Shwary?

[](#what-is-shwary)

Shwary is a Mobile Money payment platform that enables merchants to accept payments from:

- 🇨🇩 **DRC (Democratic Republic of Congo)** - Payments in Congolese Francs (CDF)
- 🇰🇪 **Kenya** - Payments in Kenyan Shillings (KES)
- 🇺🇬 **Uganda** - Payments in Ugandan Shillings (UGX)

### What does this SDK do?

[](#what-does-this-sdk-do)

This SDK allows you to easily integrate Shwary into your PHP application to:

- ✅ Initiate Mobile Money payments
- ✅ Receive payment notifications (webhooks)
- ✅ Check transaction status
- ✅ Test your integrations in sandbox mode

### How does a Mobile Money payment work?

[](#how-does-a-mobile-money-payment-work)

```
┌─────────────┐    1. Initiate payment   ┌─────────────┐
│  Your PHP   │ ───────────────────────► │   Shwary    │
│    App      │                          │    API      │
└─────────────┘                          └──────┬──────┘
                                                │
                                         2. Send request
                                                │
                                                ▼
                                         ┌─────────────┐
                                         │   Mobile    │
                                         │   Money     │
                                         │  Provider   │
                                         └──────┬──────┘
                                                │
                                         3. Customer confirms
                                            on their phone
                                                │
┌─────────────┐    4. Webhook notification      │
│  Your PHP   │ ◄───────────────────────────────┘
│    App      │    (payment confirmed)
└─────────────┘

```

---

📦 Requirements
--------------

[](#-requirements)

Before you begin, make sure you have:

### Technical Requirements

[](#technical-requirements)

- **PHP 8.2 or higher** - [Download PHP](https://php.net/downloads)
- **Composer** - [Install Composer](https://getcomposer.org/download/)
- **JSON extension** - Usually included by default

### Check your PHP version

[](#check-your-php-version)

```
php -v
# Should display: PHP 8.2.x or higher
```

### Shwary Account

[](#shwary-account)

- An active Shwary merchant account
- Your **Merchant ID** (unique identifier)
- Your **Merchant Key** (secret key)

> 💡 **Where to find your credentials?**
> Log in to your [Shwary Dashboard](https://app.shwary.com/settings) → Settings → API

---

🔧 Installation
--------------

[](#-installation)

### Step 1: Install the SDK via Composer

[](#step-1-install-the-sdk-via-composer)

Open your terminal in your project folder and run:

```
composer require shwary/php-sdk
```

### Step 2: Verify the installation

[](#step-2-verify-the-installation)

Create a test file `test-shwary.php`:

```
