wontonee / phonepe
PhonePe Payment Gateway for Bagisto - Professional integration with OAuth 2.0 authentication
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/wontonee/phonepe
Requires
- php: ^8.1|^8.2
- illuminate/support: ^10.0|^11.0
This package is not auto-updated.
Last update: 2025-10-06 19:40:18 UTC
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:cache
andphp 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