brunoadul/mpesa
最新稳定版本:v1.0.0
Composer 安装命令:
composer require brunoadul/mpesa
包简介
Mpesa payment integration for Bagisto
README 文档
README
This package provides M-Pesa payment integration for Bagisto e-commerce platform.
Installation
- Add the package to your Bagisto installation:
composer require brunoadul/mpesa
- Register the service provider in
config/app.php:
'providers' => [ // Other service providers... Brunoadul\Mpesa\Providers\MpesaServiceProvider::class, ],
- Publish the package assets:
php artisan vendor:publish --provider="Brunoadul\Mpesa\Providers\MpesaServiceProvider" --tag=mpesa-assets php artisan vendor:publish --provider="Brunoadul\Mpesa\Providers\MpesaServiceProvider" --tag=mpesa-config
- Clear the cache:
php artisan cache:clear php artisan config:clear php artisan view:clear
Configuration
Environment Variables
Add the following environment variables to your .env file:
# M-Pesa Configuration
MPESA_SANDBOX=true
MPESA_BUSINESS_SHORTCODE=174379
MPESA_CONSUMER_KEY=your_consumer_key
MPESA_CONSUMER_SECRET=your_consumer_secret
MPESA_PASSKEY=your_passkey
MPESA_INITIATOR_NAME=your_initiator_name
MPESA_INITIATOR_PASSWORD=your_initiator_password
Sandbox Testing
For sandbox testing, you can use the following credentials:
- Business Shortcode: 174379
- Consumer Key: Get from Safaricom Developer Portal
- Consumer Secret: Get from Safaricom Developer Portal
- Passkey: Get from Safaricom Developer Portal
Production Configuration
For production, update your .env file with your production credentials:
MPESA_SANDBOX=false
MPESA_BUSINESS_SHORTCODE=your_production_shortcode
MPESA_CONSUMER_KEY=your_production_consumer_key
MPESA_CONSUMER_SECRET=your_production_consumer_secret
MPESA_PASSKEY=your_production_passkey
MPESA_INITIATOR_NAME=your_production_initiator_name
MPESA_INITIATOR_PASSWORD=your_production_initiator_password
Troubleshooting
Wrong Credentials Error
If you see "Failed to initiate STK push: Wrong credentials" error, check the following:
- Ensure your Consumer Key and Consumer Secret are correct
- Make sure your Business Shortcode is correct
- Verify that your Passkey is correct
- Check that you're using the correct environment (sandbox or production)
API Connection Issues
If you're having trouble connecting to the Safaricom API:
- Ensure your server can make outbound HTTPS requests
- Check that your server's SSL certificates are up to date
- Verify that your callback URL is publicly accessible
Support
For support, please contact me at brunoadul@gmail.com
License
This package is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-28