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

ActiveLibrary[Payment Processing](/categories/payments)

moncashconnect/php-sdk
======================

PHP SDK for MonCashConnect — independent MonCash payment integration platform for Haiti.

00PHP

Since May 7Pushed 1mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

MonCashConnect PHP SDK
======================

[](#moncashconnect-php-sdk)

Official PHP SDK for the [MonCashConnect](https://moncashconnect.com) payment platform.

> **Note:** MonCashConnect is not affiliated with Digicel or the official MonCash service.

Requirements
------------

[](#requirements)

- PHP 7.4+
- `ext-curl`
- `ext-json`

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

[](#installation)

```
composer require moncashconnect/php-sdk
```

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

[](#quick-start)

```
use MonCashConnect\Client;
use MonCashConnect\Exception\MonCashException;

$client = new Client($_ENV['MCC_SECRET_KEY']);

try {
    $payment = $client->createPayment(1500, 'ORDER-001', [
        'return_url'    => 'https://yoursite.com/payment/success',
        'customer_name' => 'Jean Dupont',
    ]);

    // Redirect the customer to MonCash
    header('Location: ' . $payment['paymentUrl']);
    exit;

} catch (MonCashException $e) {
    echo 'Payment error: ' . $e->getMessage();
}
```

Your secret key starts with `sk_proj_` — get it from **Developer → Projects** in your dashboard.

Check Payment Status
--------------------

[](#check-payment-status)

```
$tx = $client->getPaymentStatus('ORDER-001');

echo $tx['status'];    // "pending" | "completed" | "failed"
echo $tx['netAmount']; // Amount after commission deduction
```

Get Account Balance
-------------------

[](#get-account-balance)

```
$balance = $client->getBalance();

echo $balance['balanceHtg'];      // Total available
echo $balance['withdrawableHtg']; // Can withdraw now
```

Webhooks
--------

[](#webhooks)

Configure a webhook URL in your project. MonCashConnect sends a signed `POST` when a payment is finalized.

Always read the **raw** body **before** any `json_decode()`.

```
use MonCashConnect\Webhook;
use MonCashConnect\Exception\MonCashException;

$rawBody   = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_MCC_SIGNATURE'] ?? '';
$timestamp = $_SERVER['HTTP_X_MCC_TIMESTAMP'] ?? '';

try {
    $event = Webhook::constructEvent(
        $rawBody,
        $signature,
        $timestamp,
        $_ENV['MCC_WEBHOOK_SECRET']
    );
} catch (MonCashException $e) {
    http_response_code($e->getCode() ?: 400);
    exit($e->getMessage());
}

switch ($event['event']) {
    case 'payment.completed':
        // Mark order as paid in your database
        markOrderPaid($event['reference']);
        break;

    case 'payment.failed':
        // Handle failure
        markOrderFailed($event['reference']);
        break;
}

http_response_code(200);
echo 'OK';
```

Laravel
-------

[](#laravel)

```
// routes/api.php
Route::post('/webhooks/moncash', [MonCashWebhookController::class, 'handle']);

// app/Http/Controllers/MonCashWebhookController.php
public function handle(Request $request): Response
{
    $event = Webhook::constructEvent(
        $request->getContent(),
        $request->header('X-MCC-Signature', ''),
        $request->header('X-MCC-Timestamp', ''),
        config('services.moncash.webhook_secret')
    );

    if ($event['event'] === 'payment.completed') {
        Order::where('reference', $event['reference'])->update(['status' => 'paid']);
    }

    return response('OK');
}
```

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

[](#error-handling)

```
catch (MonCashException $e) {
    $e->getMessage();  // "referenceId already exists for this project"
    $e->getCode();     // HTTP status: 400, 401, 409, 429, 502…
    $e->getContext();  // Full API response array, or null
}
```

License
-------

[](#license)

MIT

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance61

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/37fa49d8201c197a9f1e97ee383e5164a81d5c14a93fd6aca2997e8cba5d5a7f?d=identicon)[HTbenefactor](/maintainers/HTbenefactor)

---

Top Contributors

[![SantaClaus007](https://avatars.githubusercontent.com/u/41612165?v=4)](https://github.com/SantaClaus007 "SantaClaus007 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[omnipay/coinbase

Coinbase driver for the Omnipay payment processing library

18570.2k1](/packages/omnipay-coinbase)[yenepay/php-sdk

YenePay SDK for PHP

112.7k](/packages/yenepay-php-sdk)

PHPackages © 2026

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