PHPackages                             praisedare/monnify-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. praisedare/monnify-sdk

ActiveLibrary[Payment Processing](/categories/payments)

praisedare/monnify-sdk
======================

PHP SDK for Monnify Payment Gateway Integration

0.10.3(3mo ago)0881MITPHPPHP ^8.3

Since Jul 23Pushed 3mo agoCompare

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

READMEChangelogDependencies (7)Versions (20)Used By (0)

Monnify PHP SDK
===============

[](#monnify-php-sdk)

A comprehensive PHP SDK for integrating with the Monnify Payment Gateway. This SDK provides a clean, object-oriented interface for all Monnify API operations including payment initiation, verification, refunds, and webhook handling.

Features
--------

[](#features)

- 🚀 **Easy Integration**: Simple and intuitive API
- 🔒 **Secure**: Built-in security features and validation
- 📦 **Complete Coverage**: All Monnify API endpoints supported
- 🧪 **Well Tested**: Comprehensive test suite
- 📚 **Well Documented**: Clear documentation and examples
- 🔄 **Webhook Support**: Built-in webhook verification and handling
- 💰 **Multiple Payment Methods**: Card, Bank Transfer, USSD, etc.

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

[](#installation)

```
composer require praisedare/monnify-sdk
```

Quick Start
-----------

[](#quick-start)

### 1. Initialize the SDK

[](#1-initialize-the-sdk)

```
use PraiseDare\Monnify\Monnify;

$monnify = new Monnify([
    'secret_key' => 'your_secret_key',
    'api_key' => 'your_api_key',
    'contract_code' => 'your_contract_code',
    'environment' => 'sandbox', // or 'live'
]);
```

### 2. Initialize a Payment

[](#2-initialize-a-payment)

```
$paymentData = [
    'amount' => 1000.00,
    'customerName' => 'John Doe',
    'customerEmail' => 'john@example.com',
    'paymentReference' => 'TXN-' . uniqid(),
    'paymentDescription' => 'Payment for services',
    'currencyCode' => 'NGN',
    'contractCode' => 'your_contract_code',
    'redirectUrl' => 'https://yourwebsite.com/callback',
    'paymentMethods' => ['CARD', 'ACCOUNT_TRANSFER', 'USSD']
];

$response = $monnify->payment()->initialize($paymentData);
```

### 3. Verify Payment

[](#3-verify-payment)

```
$transactionReference = 'MNFY|20240101|123456789';
$response = $monnify->payment()->verify($transactionReference);
```

### 4. Handle Webhooks

[](#4-handle-webhooks)

```
$webhookData = $request->getContent();
$signature = $request->header('MNFY-SIGNATURE');

if ($monnify->webhook()->verify($webhookData, $signature)) {
    $payload = json_decode($webhookData, true);
    // Process the webhook data
}
```

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

```
MONNIFY_SECRET_KEY=your_secret_key
MONNIFY_API_KEY=your_api_key
MONNIFY_CONTRACT_CODE=your_contract_code
MONNIFY_ENVIRONMENT=sandbox
```

### Configuration Array

[](#configuration-array)

```
$config = [
    'secret_key' => env('MONNIFY_SECRET_KEY'),
    'api_key' => env('MONNIFY_API_KEY'),
    'contract_code' => env('MONNIFY_CONTRACT_CODE'),
    'environment' => env('MONNIFY_ENVIRONMENT', 'sandbox'),
    'timeout' => 30, // HTTP timeout in seconds
    'verify_ssl' => true, // SSL verification
];
```

API Reference
-------------

[](#api-reference)

### Payment Methods

[](#payment-methods)

#### Initialize Payment

[](#initialize-payment)

```
$response = $monnify->payment()->initialize([
    'amount' => 1000.00,
    'customerName' => 'John Doe',
    'customerEmail' => 'john@example.com',
    'paymentReference' => 'TXN-' . uniqid(),
    'paymentDescription' => 'Payment for services',
    'currencyCode' => 'NGN',
    'contractCode' => 'your_contract_code',
    'redirectUrl' => 'https://yourwebsite.com/callback',
    'paymentMethods' => ['CARD', 'ACCOUNT_TRANSFER', 'USSD']
]);
```

#### Verify Payment

[](#verify-payment)

```
$response = $monnify->payment()->verify('MNFY|20240101|123456789');
```

#### Get Transaction Status

[](#get-transaction-status)

```
$response = $monnify->payment()->getStatus('MNFY|20240101|123456789');
```

### Refund Methods

[](#refund-methods)

#### Initiate Refund

[](#initiate-refund)

```
$response = $monnify->refund()->initiate([
    'transactionReference' => 'MNFY|20240101|123456789',
    'refundAmount' => 500.00,
    'refundReason' => 'Customer request',
    'refundReference' => 'REF-' . uniqid()
]);
```

#### Get Refund Status

[](#get-refund-status)

```
$response = $monnify->refund()->getStatus('REF-' . uniqid());
```

### Settlement Methods

[](#settlement-methods)

#### Get Settlement Accounts

[](#get-settlement-accounts)

```
$response = $monnify->settlement()->getAccounts();
```

#### Get Settlement Transactions

[](#get-settlement-transactions)

```
$response = $monnify->settlement()->getTransactions([
    'page' => 1,
    'size' => 20,
    'fromDate' => '2024-01-01',
    'toDate' => '2024-01-31'
]);
```

### Webhook Methods

[](#webhook-methods)

#### Verify Webhook

[](#verify-webhook)

```
$isValid = $monnify->webhook()->verify($webhookData, $signature);
```

#### Parse Webhook

[](#parse-webhook)

```
$payload = $monnify->webhook()->parse($webhookData);
```

Error Handling
--------------

[](#error-handling)

```
try {
    $response = $monnify->payment()->initialize($paymentData);
} catch (PraiseDare\Monnify\Exceptions\MonnifyException $e) {
    // Handle Monnify-specific errors
    echo "Error: " . $e->getMessage();
    echo "Code: " . $e->getCode();
} catch (Exception $e) {
    // Handle general errors
    echo "General Error: " . $e->getMessage();
}
```

Response Format
---------------

[](#response-format)

All API responses follow a consistent format:

```
[
    'success' => true,
    'data' => [
        // Response data
    ],
    'message' => 'Operation successful',
    'code' => 'SUCCESS'
]
```

Testing
-------

[](#testing)

```
# Run tests
composer test

# Run tests with coverage
composer test-coverage

# Run static analysis
composer phpstan
```

Contributing
------------

[](#contributing)

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Run the test suite
6. Submit a pull request

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Support
-------

[](#support)

For support, please contact:

- Email:
- Documentation: [Monnify API Docs](https://docs.monnify.com)

Changelog
---------

[](#changelog)

### v1.0.0

[](#v100)

- Initial release
- Payment initialization and verification
- Refund functionality
- Settlement management
- Webhook handling
- Comprehensive error handling

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance82

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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

Every ~11 days

Total

19

Last Release

90d ago

PHP version history (2 changes)0.1PHP ^8.1

0.10PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b2e64b5e1ae456fd16878c85936eeca47ae01d8da0a94f019ee0178b914a5df?d=identicon)[praisedare](/maintainers/praisedare)

---

Top Contributors

[![praisedare](https://avatars.githubusercontent.com/u/64995858?v=4)](https://github.com/praisedare "praisedare (26 commits)")

---

Tags

phpsdkpaymentgatewayNigeriamonnify

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/praisedare-monnify-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/praisedare-monnify-sdk/health.svg)](https://phpackages.com/packages/praisedare-monnify-sdk)
```

###  Alternatives

[lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

329224.5k7](/packages/lokielse-omnipay-wechatpay)

PHPackages © 2026

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