Download the PHP package kkxdev/laravel-phonepe-autopay without Composer
On this page you can find all versions of the php package kkxdev/laravel-phonepe-autopay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-phonepe-autopay
PhonePe Payment Gateway SDK for Laravel
Production-grade PhonePe Payment Gateway SDK for Laravel with full AutoPay (Recurring Payments) support. Built with enterprise resilience patterns, comprehensive error handling, and complete test coverage.
Version 1.0.0 - Initial stable release with full PhonePe AutoPay API coverage
✨ Features
- ✅ Complete API Coverage - All PhonePe AutoPay endpoints implemented
- ✅ OAuth Token Management - Automatic token caching and refresh
- ✅ Subscription Lifecycle - Setup, status, pause, unpause, cancel, revoke
- ✅ Recurring Redemption - Notify, execute, and track recurring payments
- ✅ Refund Management - Create and track refunds
- ✅ Webhook Verification - SHA256 signature validation
- ✅ Enterprise Resilience - Retry policy with exponential backoff
- ✅ Circuit Breaker - Protection against cascading failures
- ✅ Immutable DTOs - Type-safe request/response objects with validation
- ✅ PSR-3 Logging - Comprehensive logging throughout
- ✅ Laravel 8.x | 9.x | 10.x | 11.x | 12.x - Compatible with modern Laravel versions
- ✅ PHP 8.0+ - Modern PHP with strict types
📦 Installation
Install via Composer:
Publish the configuration file:
⚙️ Configuration
Add your PhonePe credentials to .env:
🚀 Usage
Setup Subscription
Check Subscription Status
Check Order Status
Notify Redemption (Recurring Payment)
Important: Must be called 24 hours before executing redemption.
Execute Redemption (Charge Customer)
Important: Call this after 24-hour notification period.
Check Redemption Status
Cancel Subscription
Create Refund
Check Refund Status
🔔 Webhook Handling
PhonePe sends webhooks for subscription lifecycle events (pause, unpause, revoke).
Verify Webhook Signature
🔐 Security
Token Management
- OAuth tokens are automatically cached with TTL
- Tokens refresh 90 seconds before expiry
- Thread-safe caching via Laravel's cache system
Webhook Verification
- SHA256 signature validation
- Configurable username/password
- Protects against replay attacks
Idempotency
- Use idempotency keys for redemption execution
- Prevents duplicate charges
🛡️ Resilience
Retry Policy
Automatically retries failed requests with exponential backoff:
Retry Triggers:
- Network timeouts
- Connection failures
- 5xx server errors
Non-Retryable:
- 4xx client errors (validation, auth, etc.)
Circuit Breaker
Protects against cascading failures:
States:
- CLOSED: Normal operation
- OPEN: Blocking requests (service is down)
- HALF_OPEN: Testing recovery
📊 Subscription Flow Diagram
🧪 Testing
Mock HTTP Responses
🏗️ Architecture
This package follows SOLID principles and enterprise design patterns:
- Adapter Pattern: HTTP client abstraction
- Strategy Pattern: Environment switching (sandbox/production)
- Factory Pattern: Versioned API clients
- DTO Pattern: Immutable request/response objects
- Retry Policy Pattern: Network resilience
- Circuit Breaker Pattern: Service protection
- Facade Pattern: Developer ergonomics
📘 API Reference
SubscriptionApiInterface
| Method | Description |
|---|---|
setup(SubscriptionSetupRequest) |
Create new subscription |
getOrderStatus(string) |
Check order status |
getStatus(string) |
Check subscription status |
cancel(string) |
Cancel active subscription |
RedemptionApiInterface
| Method | Description |
|---|---|
notify(RedemptionNotifyRequest) |
Notify upcoming charge (24h before) |
execute(RedemptionExecuteRequest) |
Execute recurring charge |
getStatus(string) |
Check redemption status |
RefundApiInterface
| Method | Description |
|---|---|
create(RefundRequest) |
Create refund |
getStatus(string) |
Check refund status |
🤝 Contributing
Contributions are welcome! Please ensure:
- Code follows PSR-12 standards
- All tests pass
- New features include tests
- Documentation is updated
📄 License
MIT License. See LICENSE for details.
🙏 Support
Built with ❤️ by KKXDev
All versions of laravel-phonepe-autopay with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/http Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/cache Version ^8.0|^9.0|^10.0|^11.0|^12.0
psr/log Version ^1.0|^2.0|^3.0