youkeofficial / laravel-chapchap
Intégration Laravel pour l'API de paiement ChapChap
v1.0.0
2026-07-28 22:02 UTC
Requires
- php: ^8.1
- illuminate/support: ^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0|^11.0
README
Package Laravel pour intégrer l'API de paiement ChapChap (Guinée) par YoukeOfficial pour votre bonheur.
Installation
composer require youkeofficial/laravel-chapchap
Le ServiceProvider et la Facade sont enregistrés automatiquement via le package auto-discovery de Laravel.
Publie le fichier de configuration :
php artisan vendor:publish --tag=chapchap-config
Configuration
Ajoute ces variables dans ton .env :
CHAPCHAP_API_KEY=ta_cle_api CHAPCHAP_ENCRYPT_KEY=ta_cle_hmac CHAPCHAP_BASE_URL=https://chapchappay.com/api CHAPCHAP_NOTIFY_URL=https://tonapp.com/payments/notify CHAPCHAP_RETURN_URL=https://tonapp.com/payments/return CHAPCHAP_CANCEL_URL=https://tonapp.com/payments/cancel
Utilisation
Via la Facade
use Youkeofficial\ChapChap\Facades\ChapChap; // Créer un paiement $result = ChapChap::requestPayment( amount: 10000, orderId: 'ORDER-123', description: 'Paiement commande #123' ); // Rediriger l'utilisateur return redirect($result['payment_url']);
Via l'injection de dépendances
use Youkeofficial\ChapChap\Services\ChapChapService; class PaymentController extends Controller { public function __construct(private ChapChapService $chapchap) {} public function create(): RedirectResponse { $result = $this->chapchap->requestPayment( amount: 10000, orderId: 'ORDER-123', description: 'Paiement commande #123' ); return redirect($result['payment_url']); } }
Vérifier un paiement
$data = ChapChap::requestVerification($operationId); // Normaliser le statut vers : 'created' | 'processing' | 'success' | 'cancel' | 'error' $status = ChapChap::normalizeChapChapStatus($data['status']['code']);
Méthodes disponibles
| Méthode | Description |
|---|---|
requestPayment(int $amount, string $orderId, string $description, string $paymentMethod) |
Initie un paiement, retourne payment_url |
requestVerification(string $operationId) |
Vérifie le statut d'un paiement |
normalizeChapChapStatus(string $status) |
Normalise le code de statut ChapChap |
Tests
composer install vendor/bin/phpunit
Licence
MIT