laravel-nepal-payment maintained by bibek-deula
Laravel Nepal Payment Gateway
A Laravel package for integrating Nepal's popular payment gateways: eSewa, Khalti, and Fonepay.
Features
- ✅ eSewa - Nepal's leading payment gateway
- ✅ Khalti - Digital wallet and payment gateway
- ✅ Fonepay - Unified payment gateway
- 🎨 Modern Bootstrap 5 UI
- 🔧 Easy configuration
- 📦 Ready-to-use payment page
- 🔒 Secure payment processing
Installation
1. Install via Composer
composer require bibek-deula/laravel-nepal-payment
2. Publish Package Files
Publish configuration, views, and assets:
php artisan vendor:publish --provider="BibekDeula\LaravelNepalPayment\NepalPaymentServiceProvider"
Or publish individually:
# Publish config only
php artisan vendor:publish --tag=nepal-payment-config
# Publish views only
php artisan vendor:publish --tag=nepal-payment-views
# Publish assets only
php artisan vendor:publish --tag=nepal-payment-assets
3. Configure Environment Variables
Add the following to your .env file:
# eSewa Configuration
ESEWA_MERCHANT_CODE=EPAYTEST
ESEWA_ENVIRONMENT=test
# Khalti Configuration
KHALTI_SECRET_KEY=your_secret_key_here
KHALTI_PUBLIC_KEY=your_public_key_here
KHALTI_ENVIRONMENT=test
# Fonepay Configuration
FONEPAY_MERCHANT_CODE=your_merchant_code
FONEPAY_SECRET_KEY=your_secret_key
FONEPAY_ENVIRONMENT=test
# Route Configuration (optional)
NEPAL_PAYMENT_ROUTE_PREFIX=payment
4. Install Dependencies
npm install
npm install bootstrap jquery
npm run dev
Usage
Access Payment Page
Navigate to: http://your-domain/payment
Test Credentials
eSewa
- Merchant Code:
EPAYTEST
Khalti
- Test IDs: 9800000000, 9800000001, etc.
- MPIN: 1111
- OTP: 987654
Fonepay
- Bank: Global IME Bank
- Username: 98XXXXXXXX (any 10-digit)
- Password: 1212122
- OTP: 1212122
Configuration
After publishing, edit config/nepal-payment.php to customize:
- Payment gateway credentials
- URLs (test/live)
- Route prefix and middleware
- Success/failure redirect URLs
Routes
The package provides these routes (with payment prefix by default):
GET /payment - Payment page
GET /payment/fonepay/success - Fonepay success callback
GET /payment/fonepay/failure - Fonepay failure
ANY /payment/esewa/payment-success - eSewa success
GET /payment/esewa/failure - eSewa failure
POST /payment/khalti/initiate - Khalti payment initiation
GET /payment/khalti/success - Khalti success callback
GET /payment/khalti/failure - Khalti failure
Customization
Views
Views are published to resources/views/vendor/nepal-payment/. Customize as needed.
Assets
JS and CSS are published to:
resources/js/vendor/nepal-payment/resources/css/vendor/nepal-payment/
Make sure to include them in your Vite build or compile separately.
Future Additions
This package is designed to be extensible. Future versions will include:
- HBL Bank integration
- Nabil Bank integration
- ConnectIPS integration
- Other Nepalese payment gateways
License
MIT License
Author
Bibek Deula
- Email: bbkdeula@gmail.com
Support
For issues and feature requests, please create an issue on GitHub.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.