Search by

sangho / sdk

evangzat

SDK officiel PHP pour l'API Sangho

dev-main 2026-09-13 14:12 UTC

This package is not auto-updated.

Last update: 2026-09-14 12:36:28 UTC


README

SDK officiel PHP pour l'API Sangho — paiements XAF pour l'Afrique.

Packagist CI License: MIT

Installation

composer require sangho/sdk

Quickstart

use Sangho\SanghoClient;

$client = new SanghoClient('sk_prod_...');

// Créer un payment intent
$intent = $client->paymentIntents->create([
    'amount'   => 5000,
    'currency' => 'XAF',
    'customer' => 'cust_xxx',
]);

echo $intent['id'];

Gestion des erreurs

use Sangho\Exception\{
    SanghoAuthException,
    SanghoRateLimitException,
    SanghoValidationException,
    SanghoException,
};

try {
    $intent = $client->paymentIntents->create(['amount' => 5000, 'customer' => 'cust_xxx']);
} catch (SanghoAuthException $e) {
    echo "Clé API invalide";
} catch (SanghoRateLimitException $e) {
    echo "Trop de requêtes, retenter après {$e->retryAfter}s";
} catch (SanghoValidationException $e) {
    echo $e->getParam() . ': ' . $e->getMessage();
} catch (SanghoException $e) {
    echo "{$e->errorCode} — {$e->getMessage()} ({$e->statusCode})";
}

Documentation

La documentation complète est disponible sur docs.sangho.ga/api/sdks/php.

Ressources disponibles

account · addresses · apps · customers · products · paymentIntents · checkoutSessions · invoices · transactions · refunds · subscriptions · paymentMethods · receipts · webhooks · paymentLinks · security · partners · terminal · sandbox

Contribuer

Voir CONTRIBUTING.md.

Changelog

Voir CHANGELOG.md.

Licence

MIT