wontonee/phonepe
最新稳定版本:1.0.2
Composer 安装命令:
composer require wontonee/phonepe
包简介
PhonePe Payment Gateway for Bagisto - Professional integration with OAuth 2.0 authentication
README 文档
README
Professional PhonePe payment gateway integration for Bagisto e-commerce platform with OAuth 2.0 authentication.
🚀 Features
Payment Processing
- OAuth 2.0 Authentication: Secure token-based API authentication
- Multiple Payment Methods: UPI, Cards, Net Banking, and Wallets
- Environment Support: Sandbox for testing, Production for live transactions
- Automatic Amount Conversion: Handles paisa conversion automatically
- Order Management: Seamless integration with Bagisto order system
Security & Reliability
- Secure Token Generation: OAuth 2.0 access token with automatic expiry handling
- Payment Verification: Server-side payment status verification
- Session Management: Secure session handling for payment data
- Comprehensive Logging: Detailed logs for debugging and monitoring
Admin Features
- Easy Configuration: Simple admin panel setup
- Environment Toggle: Switch between Sandbox and Production
- Customizable: Configure order expiry time
- Payment Method Icon: Upload custom payment method icon
📋 Requirements
- Bagisto 2.x
- PHP 8.1 or higher
- PhonePe Business Account
- Client ID and Client Secret from PhonePe Dashboard
📦 Installation
Step 1: Install via Composer
composer require wontonee/phonepe
Step 2: Publish Assets
php artisan vendor:publish --tag=phonepe-assets
Step 3: Clear Cache
php artisan config:cache php artisan route:cache php artisan optimize:clear
⚙️ Configuration
1. Get PhonePe Credentials
- Login to PhonePe Business Dashboard
- Navigate to Developer Settings
- Copy your Client ID and Client Secret
2. Configure in Bagisto Admin
- Go to Admin Panel → Configuration → Sales → Payment Methods
- Find PhonePe in the payment methods list
- Configure the following fields:
| Field | Description | Required |
|---|---|---|
| Title | Display name for payment method | Yes |
| Description | Description shown to customers | No |
| Payment Method Icon | Upload custom icon (100x50px recommended) | No |
| Environment | Select Sandbox or Production | Yes |
| Client ID | Your PhonePe Client ID | Yes |
| Client Secret | Your PhonePe Client Secret | Yes |
| Client Version | API Client Version (Default: 1) | Yes |
| Checkout Type | Select Standard or Express (Default: Standard) | Yes |
| Status | Enable/Disable payment method | Yes |
- Click Save Configuration
🔧 How It Works
Payment Flow
- Customer Checkout: Customer selects PhonePe and places order
- OAuth Authentication: System generates OAuth access token
- Payment Creation: Payment order created via PhonePe API
- Redirect to PhonePe: Customer redirected to PhonePe payment page
- Payment Processing: Customer completes payment on PhonePe
- Callback: PhonePe redirects back with payment status
- Verification: System verifies payment status with PhonePe
- Order Creation: Order created if payment successful
API Endpoints
Sandbox:
- Auth:
https://api-preprod.phonepe.com/apis/pg-sandbox/v1/oauth/token - Payment:
https://api-preprod.phonepe.com/apis/pg-sandbox/checkout/v2/pay
Production:
- Auth:
https://api.phonepe.com/apis/identity-manager/v1/oauth/token - Payment:
https://api.phonepe.com/apis/pg/checkout/v2/pay
🧪 Testing
Sandbox Testing
- Set Environment to Sandbox
- Use your PhonePe sandbox credentials
- Test with PhonePe test payment methods
Test Credentials
Contact PhonePe support for sandbox test credentials.
📝 Important Notes
Amount Handling
- PhonePe requires amounts in paisa (₹10 = 1000 paisa)
- Minimum order amount: ₹1 (100 paisa)
- System automatically converts rupees to paisa
Order Expiry
- Minimum: 300 seconds (5 minutes)
- Maximum: 3600 seconds (60 minutes)
- Default: 1800 seconds (30 minutes)
- Fixed at 30 minutes for optimal user experience
Payment States
PENDING: Payment initiated but not completedCOMPLETED: Payment successfulFAILED: Payment failed
🔍 Troubleshooting
Common Issues
1. "PhonePe credentials not configured"
- Solution: Check Client ID and Client Secret in admin configuration
2. "Minimum order amount is ₹1"
- Solution: Ensure cart total is at least ₹1
3. "Payment verification failed"
- Solution: Check PhonePe API credentials and environment setting
4. OAuth token generation failed
- Solution: Verify Client ID, Client Secret, and network connectivity
5. Route not found errors
- Solution: Run
php artisan route:cacheandphp artisan config:cache
Debug Logs
Check logs in storage/logs/laravel.log for detailed error information.
🆘 Support
For support, contact:
- Email: dev@wontonee.com
- Website: https://www.wontonee.com
- WhatsApp: +91 9711381236
📄 License
This package is proprietary software by Wontonee.
🔮 Upcoming Features (Phase 3)
- ✅ Webhook integration for real-time updates
- ✅ Refund functionality from admin panel
- ✅ Order status API integration
- ✅ Fallback mechanism for missed payments
📚 Additional Resources
Developed with ❤️ by Wontonee
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2025-10-06