PHPackages                             camerpay/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. [API Development](/categories/api)
4. /
5. camerpay/php-sdk

ActiveLibrary[API Development](/categories/api)

camerpay/php-sdk
================

Official PHP SDK for CamerPay - Mobile Money, cards and PayPal payments for Cameroon.

v1.0.1(1mo ago)00MITPHPPHP ^8.1

Since Jun 6Pushed 1mo agoCompare

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

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

CamerPay PHP SDK
================

[](#camerpay-php-sdk)

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![PHP Version](https://camo.githubusercontent.com/d94da5b84eac3af68cb611609ef21f04dff28b2bfb3daf366d3922a79a475838/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e312d626c75652e737667)](https://php.net)

SDK PHP officiel pour [CamerPay](https://camerpay.biz) — passerelle de paiement Mobile Money, cartes et PayPal au Cameroun.

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

[](#installation)

```
composer require camerpay/php-sdk
```

Requis : **PHP 8.1+** avec extensions `curl` et `json`.

Démarrage rapide
----------------

[](#démarrage-rapide)

### Initier un paiement

[](#initier-un-paiement)

```
use CamerPay\CamerPay;

$camerpay = new CamerPay($_ENV['CAMERPAY_TOKEN']);

$tx = $camerpay->payments->initiate([
    'amount'                => 5000,
    'currency'              => 'XAF',
    'payment_method'        => 'orange_money',
    'customer_phone'        => '+237690000000',
    'customer_email'        => 'client@exemple.com',
    'merchant_invoice_id'   => 'FACT-001',
    'merchant_callback_url' => 'https://votre-site.com/webhooks/camerpay',
    'merchant_return_url'   => 'https://votre-site.com/merci',
]);

// Rediriger le client vers la page de paiement
header('Location: ' . $tx['pay_url']);
```

### Vérifier le statut

[](#vérifier-le-statut)

```
$tx = $camerpay->payments->status('5add2319-f71b-4f2d-a4f4-97fe0d11c1d4');

if ($tx['transaction']['status'] === 'completed') {
    // Marquer la commande comme payée
}
```

### Rembourser

[](#rembourser)

```
// Remboursement total
$camerpay->payments->refund($uuid);

// Remboursement partiel
$camerpay->payments->refund($uuid, amount: 2500, reason: 'Geste commercial');
```

### Versements groupés (Mass Payout)

[](#versements-groupés-mass-payout)

```
$batch = $camerpay->payouts->createBatch([
    'reference'    => 'SALAIRES-2026-06',
    'callback_url' => 'https://votre-site.com/webhooks/payouts',
    'beneficiaries' => [
        ['phone' => '+237690000001', 'amount' => 75000, 'operator' => 'orange_money', 'name' => 'Jean'],
        ['phone' => '+237670000002', 'amount' => 50000, 'operator' => 'mtn_momo',     'name' => 'Aisha'],
    ],
]);

echo "Batch UUID : " . $batch['batch_uuid'];
```

Vérifier un webhook
-------------------

[](#vérifier-un-webhook)

```
use CamerPay\CamerPay;
use CamerPay\Exceptions\WebhookException;

$verifier = CamerPay::webhooks($_ENV['CAMERPAY_WEBHOOK_SECRET']);

try {
    $event = $verifier->verifyFromRequest();

    if ($event['status'] === 'completed') {
        // Marquer la commande comme payée
    }

    http_response_code(200);
    echo 'OK';
} catch (WebhookException $e) {
    http_response_code(401);
    echo 'Invalid signature';
}
```

Gestion d'erreurs
-----------------

[](#gestion-derreurs)

Toutes les exceptions héritent de `CamerPay\Exceptions\CamerPayException` :

```
use CamerPay\Exceptions\AuthenticationException;
use CamerPay\Exceptions\QuotaExceededException;
use CamerPay\Exceptions\ValidationException;
use CamerPay\Exceptions\NotFoundException;
use CamerPay\Exceptions\ServerException;
use CamerPay\Exceptions\CamerPayException;

try {
    $tx = $camerpay->payments->initiate([...]);
} catch (AuthenticationException $e) {
    // 401 — token invalide ou révoqué
} catch (QuotaExceededException $e) {
    // 402 — plafond KYC atteint OU quota plan dépassé
    echo $e->getNextAction();   // "Fournissez votre attestation NIU..."
    echo $e->getUpgradeUrl();   // https://camerpay.biz/client/kyc
    echo $e->getRemainingAmount(); // 5000 XAF restant ce mois
} catch (ValidationException $e) {
    // 422 — données invalides
    print_r($e->getFieldErrors());
} catch (NotFoundException $e) {
    // 404 — UUID inconnu
} catch (ServerException $e) {
    // 5xx — erreur côté CamerPay, retry recommandé
} catch (CamerPayException $e) {
    // Tout le reste
}
```

Configuration avancée
---------------------

[](#configuration-avancée)

```
$camerpay = new CamerPay(
    apiKey:  $_ENV['CAMERPAY_TOKEN'],
    baseUrl: 'https://camerpay.biz/api',  // Override si proxy/staging
    timeout: 30,                          // Secondes
);
```

Sécurité
--------

[](#sécurité)

- ✅ Vérification HMAC-SHA256 avec `hash_equals()` (timing-attack safe)
- ✅ TLS 1.2+ enforced via `CURLOPT_SSL_VERIFYPEER`
- ✅ Pas de dépendances externes (cURL natif, zéro Guzzle)
- ✅ Tous les secrets via `$_ENV` recommandé

**Ne JAMAIS** :

- ❌ Committer votre token API dans Git
- ❌ Logger le payload brut (peut contenir des données sensibles)
- ❌ Exposer votre `CAMERPAY_WEBHOOK_SECRET` côté frontend

Documentation API
-----------------

[](#documentation-api)

- Documentation complète : [camerpay.biz/docs](https://camerpay.biz/docs)
- Démarrage rapide : [camerpay.biz/docs/getting-started](https://camerpay.biz/docs/getting-started)
- Référence webhooks : [camerpay.biz/docs/webhooks](https://camerpay.biz/docs/webhooks)
- Codes d'erreur : [camerpay.biz/docs/errors](https://camerpay.biz/docs/errors)

Support
-------

[](#support)

- Email :
- Issues GitHub :
- Dashboard marchand :

Licence
-------

[](#licence)

[MIT](LICENSE)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance92

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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 ~1 days

Total

2

Last Release

47d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/57388b0d5461e6b7c4ccc19d5b6d9f339d30fa6e7cbbdbece7b19158a3bc0a9c?d=identicon)[madengue](/maintainers/madengue)

---

Top Contributors

[![madengue](https://avatars.githubusercontent.com/u/29689232?v=4)](https://github.com/madengue "madengue (2 commits)")

---

Tags

apisdkstripepaymentpaypalmobile-moneyOrange Moneymtn momoCamerooncamerpay

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60316.0M89](/packages/mollie-mollie-api-php)

PHPackages © 2026

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