-
Notifications
You must be signed in to change notification settings - Fork 9
Troubleshooting
Common issues and solutions when using the JazzCash package.
Error: Class 'zfhassaan\jazzcash\provider\ServiceProvider' not found
Solution:
- Ensure package is installed:
composer require zfhassaan/jazzcash - Run
composer dump-autoload - For Laravel < 11, register service provider in
config/app.php
Error: Class 'Jazzcash' not found
Solution:
- Ensure facade is registered in
config/app.php(Laravel < 11) - Check namespace:
use Jazzcash;or\Jazzcash:: - Run
php artisan config:clear
Error: Configuration values are null or empty
Solution:
- Clear config cache:
php artisan config:clear - Verify
.envfile has all required variables - Check
config/jazzcash.phpexists - Run
php artisan config:cacheafter changes
Error: Requests going to wrong endpoint
Solution:
- Check
JAZZCASH_PAYMENTMODEin.env(sandbox vs production) - Verify
JAZZCASH_PRODUCTION_URLandJAZZCASH_SANDBOX_URLare correct - Clear config cache:
php artisan config:clear
Error: Authentication failures or invalid credentials
Solution:
- Verify credentials in JazzCash dashboard
- Check for extra spaces in
.envvalues - Ensure you're using correct mode (sandbox vs production)
- Verify merchant ID, password, and hash key are correct
Error: JazzCash configuration missing: ...
Solution:
- Check all required environment variables are set
- Verify no typos in variable names
- Ensure values are not empty
- Check
.envfile syntax
Error: Amount must be positive
Solution:
- Ensure amount is greater than 0
- Check amount format (can be float, int, or string)
- Verify amount is not negative
Error: Bill reference is required
Solution:
- Ensure bill reference is set before calling
sendRequest() - Check bill reference is not empty string
- Verify
setBillReference()is called
Error: Product description is required
Solution:
- Ensure product description is set
- Check description is not empty
- Verify
setProductDescription()is called
Error: Form doesn't auto-submit to JazzCash
Solution:
- Check JavaScript is enabled in browser
- Verify form HTML is correct
- Check browser console for errors
- Ensure form action URL is correct
Error: Hash verification fails on callback
Solution:
- Ensure hash key is correct
- Verify parameter order matches JazzCash requirements
- Check for empty/null values in hash array
- Ensure hash generation uses same order as verification
Error: No response from sendRequest()
Solution:
- Check all required data is set
- Verify configuration is correct
- Check for exceptions (wrap in try-catch)
- Verify API URL is accessible
Error: Response format is unexpected
Solution:
- Check response is HTML form
- Verify all required fields are present
- Check for JavaScript errors
- Ensure form structure is correct
Error: JazzCash doesn't redirect to callback URL
Solution:
- Check callback URL is configured correctly
- Verify URL is publicly accessible
- Check URL uses HTTPS (required for production)
- Verify URL in JazzCash dashboard
Error: Hash verification fails on callback
Solution:
- Rebuild hash using same order as sent
- Verify hash key is correct
- Check all parameters are included
- Ensure empty values are handled correctly
Error: Unknown response code
Solution:
- Check JazzCash documentation for response codes
- Handle all possible response codes
- Log unknown codes for investigation
- Default to failed status for unknown codes
Add to .env:
APP_DEBUG=true
LOG_LEVEL=debug# Laravel logs
tail -f storage/logs/laravel.log
# Check for JazzCash related errors
grep -i jazzcash storage/logs/laravel.logphp artisan tinker
# Test configuration
config('jazzcash.mode');
config('jazzcash.merchant_id');
# Test instance creation
$jazzcash = new \zfhassaan\JazzCash\JazzCash();
$jazzcash->setAmount(100);
$jazzcash->getAmount();Cause: Amount is zero or negative
Solution: Ensure amount is greater than 0
Cause: Bill reference not set or empty
Solution: Call setBillReference() with a non-empty value
Cause: Product description not set or empty
Solution: Call setProductDescription() with a non-empty value
Cause: Required configuration value is missing
Solution: Set the missing environment variable in .env
Cause: API URL not set based on mode
Solution: Set JAZZCASH_PRODUCTION_URL or JAZZCASH_SANDBOX_URL in .env
If you're still experiencing issues:
- Check Documentation: Review all wiki pages
- Check Issues: Search GitHub issues
- Review Logs: Check application logs
- Test in Sandbox: Verify in sandbox mode first
- Contact Support: Email zfhassaan@gmail.com
| Code | Status | Description |
|---|---|---|
000 |
Success | Payment successful |
001 |
Failed | Payment failed |
002 |
Cancelled | Payment cancelled |
003 |
Pending | Payment pending |
-
INVALID_AMOUNT- Amount validation failed -
MISSING_BILL_REFERENCE- Bill reference not set -
MISSING_DESCRIPTION- Product description not set -
CONFIG_ERROR- Configuration error
- Configuration Guide - Verify configuration
- API Reference - Check method usage
- Payment Flow - Understand flow