laravel-squad maintained by koderia-creative-lab
Laravel Squad (HabariPay)
A modern Laravel client for the Squad (HabariPay) payment gateway supporting automatic sandbox/production routing, transaction initialization, verification, and HMAC SHA-512 webhook signature validation.
Installation
composer require koderia-creative-lab/laravel-squad
Publish configuration:
php artisan vendor:publish --tag="squad-config"
Configuration
Set the following environment variables in .env:
SQUAD_SECRET_KEY=your_secret_key
SQUAD_ENV=sandbox
SQUAD_REDIRECT_URL=https://your-app.com/payment/callback
SQUAD_SPLIT_MODE=false
SQUAD_TIMEOUT=30
SQUAD_LOGGING=true
Usage
Initialize a Transaction
use Koderia\Squad\Facades\Squad;
$response = Squad::initialize([
'amount' => 1500000, // in kobo (₦15,000)
'email' => 'customer@example.com',
'transaction_ref' => 'UNIQUE_TX_REF',
'customer_name' => 'Ada Lovelace',
'metadata' => ['order_id' => 102],
]);
if ($response->isSuccessful()) {
return redirect($response->getCheckoutUrl());
}
$error = $response->getErrorMessage();
Verify a Transaction
use Koderia\Squad\Facades\Squad;
$verification = Squad::verify($reference);
if ($verification->isPaid()) {
$amount = $verification->getAmount();
$meta = $verification->getMetaData();
}
Validate Webhook Signatures
use Koderia\Squad\Facades\Squad;
$isValid = Squad::verifyWebhookSignature(
$request->getContent(),
(string) $request->header('x-squad-encrypted-body')
);
Testing
vendor/bin/phpunit