PHPackages                             elongo/pay-php - 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. elongo/pay-php

ActiveLibrary

elongo/pay-php
==============

SDK PHP officiel pour Elongo Pay — sessions de checkout et vérification des webhooks.

v0.2.0(yesterday)01↑2900%MITPHP ^8.2

Since Jul 22Compare

[ Source](https://github.com/elongocrea/pay-php)[ Packagist](https://packagist.org/packages/elongo/pay-php)[ RSS](/packages/elongo-pay-php/feed)WikiDiscussions Synced today

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

Elongo Pay — SDK PHP
====================

[](#elongo-pay--sdk-php)

SDK officiel pour [Elongo Pay](https://elongopay.cd) : crée des sessions de checkout et vérifie les webhooks, sans écrire une seule ligne d'appel HTTP ni de vérification de signature.

Aucune dépendance runtime (cURL + JSON, tous deux fournis par PHP).

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

[](#installation)

```
composer require elongo/pay-php
```

Créer un paiement
-----------------

[](#créer-un-paiement)

Le client est redirigé vers une page hébergée par Elongo Pay. Votre application ne voit jamais de numéro de carte ni de moyen de paiement.

```
use Elongo\Pay\Client;

$pay = new Client('sk_live_votre_cle');

$session = $pay->checkout->create([
    'amount'              => 25000,
    'currency'            => 'CDF',
    'success_url'         => 'https://votre-app.cd/commande/ok',
    'cancel_url'          => 'https://votre-app.cd/commande/ko',
    'client_reference_id' => $commande->id,
    'metadata'            => ['commande_id' => $commande->id],
], idempotencyKey: "commande-{$commande->id}");

header('Location: '.$session['url']);
```

L'`idempotencyKey` (facultative mais recommandée) garantit qu'un rejeu réseau ne crée pas deux sessions pour la même commande.

Récupérer une session ou un paiement
------------------------------------

[](#récupérer-une-session-ou-un-paiement)

```
$session = $pay->checkout->retrieve('cs_live_…');
$payment = $pay->payments->retrieve('…');
```

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

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

Elongo Pay notifie votre `callback_url` à chaque changement d'état. **Vérifiez toujours la signature** avant de traiter l'événement : c'est ce qui prouve qu'il vient bien d'Elongo Pay.

```
use Elongo\Pay\Webhook;
use Elongo\Pay\Exception\ElongoPayException;

$payload = file_get_contents('php://input');
$header  = $_SERVER['HTTP_ELONGO_SIGNATURE'] ?? '';
$secret  = getenv('ELONGO_WEBHOOK_SECRET'); // whsec_…

try {
    $event = Webhook::constructEvent($payload, $header, $secret);
} catch (ElongoPayException) {
    http_response_code(400);
    exit;
}

if ($event['type'] === 'checkout.session.completed') {
    $session = $event['data'];
    // Marquer la commande $session['client_reference_id'] comme payée.
}

http_response_code(200);
```

### Le schéma de signature

[](#le-schéma-de-signature)

Pour les intégrations hors PHP, l'en-tête est documenté et réimplémentable :

```
Elongo-Signature: t=,v1=

```

Recomposez `"."`, calculez le HMAC-SHA256 avec votre secret, comparez en temps constant, et rejetez au-delà de 5 minutes d'écart (anti-rejeu).

Tests
-----

[](#tests)

```
composer install
./vendor/bin/pest
```

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

[](#configuration-avancée)

```
// Environnement de test, ou transport personnalisé (tests, proxy).
$pay = new Client('sk_test_…', 'https://api.elongopay.cd', $transport);
```

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

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

Total

2

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/54002007?v=4)[merdielongo](/maintainers/merdielongo)[@merdielongo](https://github.com/merdielongo)

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/elongo-pay-php/health.svg)

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

PHPackages © 2026

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