youkeofficial/laravel-chapchap

Intégration Laravel pour l'API de paiement ChapChap

Maintainers

Package info

github.com/youkeofficial/laravel-chapchap

pkg:composer/youkeofficial/laravel-chapchap

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-07-28 22:02 UTC

This package is auto-updated.

Last update: 2026-07-28 22:09:19 UTC


README

PHP Laravel License: MIT

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