aticmatic/laravel-jazzcash
Laravel package for JazzCash Mobile Wallet REST API v2.0: initiate wallet payments, verify secure callbacks (HMAC-SHA256), and inquire transaction status. Configurable for sandbox/live. Requires pp_CNIC (last 6 CNIC digits).
PaymentProcessed, TransactionFailed) for async processing (e.g., via Laravel Queues or Laravel Echo). This requires custom implementation but leverages Laravel’s ecosystem.JazzCash facade/client.Http client under the hood (configurable via config/jazzcash.php).validateJazzCashWebhook).transactions table (migrations provided). Compatible with Eloquent, Query Builder, or raw PDO.transaction_status_updated). Requires routing (routes/web.php) and middleware setup.| Risk Area | Severity | Mitigation |
|---|---|---|
| API Version Lock-in | Medium | JazzCash v2.0 may evolve; package lacks versioning abstraction. Monitor API changes. |
| Webhook Reliability | High | No built-in retry logic for failed webhook deliveries. Implement queue + exponential backoff. |
| Error Handling | Medium | Limited custom exceptions; extend JazzCashException for granular error types. |
| Testing Coverage | Low | No tests in repo. Mock JazzCash API responses in PHPUnit/Pest for CI/CD. |
| Rate Limiting | Medium | No built-in throttling. Use Laravel’s throttle middleware or API client retries. |
| OAuth2 Token Management | Medium | Tokens stored in config/jazzcash.php (plaintext risk). Use Laravel Vault or encrypted config. |
spatie/fractal).vcr/vcr for recording responses).composer.json). Ensure compatibility if using LTS (e.g., 9.x).php-curl, php-json, and php-mbstring (standard in Laravel).guzzlehttp/guzzle (for HTTP requests) – version pinned to ^7.0.laravel/framework (for core Laravel features).spatie/laravel-activitylog, laravel/breeze).transactions table. Extend with custom tables if needed (e.g., jazzcash_payouts).createWalletTopup()).composer require aticmatic/laravel-jazzcash
php artisan vendor:publish --provider="AticMatic\JazzCash\JazzCashServiceProvider"
.env:
JAZZCASH_CLIENT_ID=your_id
JAZZCASH_CLIENT_SECRET=your_secret
JAZZCASH_BASE_URL=https://api.jazzcash.com/v2.0
use AticMatic\JazzCash\Facades\JazzCash;
$response = JazzCash::createWalletTopup([
'amount' => 100,
'msisdn' => '923001234567',
]);
Route::post('/jazzcash/webhook', [JazzCashWebhookController::class, 'handle']);
// app/Http/Middleware/VerifyJazzCashWebhook.php
public function handle($request, Closure $next) {
return JazzCash::verifyWebhook($request);
}
event(new JazzCashWebhookReceived($payload));
JazzCash::processWebhook($payload)->onQueue('jazzcash');
database or redis driver).createWalletTopup, checkBalance, and verifyTransaction.monolog).aticmatic/laravel-jazzcash for updates (currently no changelog; assume breaking changes possible).composer.json to avoid surprises:
"require": {
"aticmatic/laravel-jazzcash": "^1.0"
}
.env or Laravel Vault.php artisan config:clear cautiously (may reset sensitive keys).JAZZCASH_CLIENT_ID/SECRET and API key permissions.JAZZCASH_WEBHOOK_SECRET.config/jazzcash.php.JazzCash::withMiddleware(function ($stack) {
$stack->push(Middleware::tap(function ($request) {
Log::debug('JazzCash Request', $request->getBody());
}));
});
How can I help you explore Laravel packages today?