feat: implement comprehensive multi-provider payment processing system
- Add unified payment provider architecture with contract-based design - Implement 6 payment providers: Stripe, Lemon Squeezy, Polar, Oxapay, Crypto, Activation Keys - Create subscription management with lifecycle handling (create, cancel, pause, resume, update) - Add coupon system with usage tracking and trial extensions - Build Filament admin resources for payment providers, subscriptions, coupons, and trials - Implement payment orchestration service with provider registry and configuration management - Add comprehensive payment logging and webhook handling for all providers - Create customer analytics dashboard with revenue, churn, and lifetime value metrics - Add subscription migration service for provider switching - Include extensive test coverage for all payment functionality
This commit is contained in:
76
routes/payment.php
Normal file
76
routes/payment.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\PaymentController;
|
||||
use App\Http\Controllers\PaymentProviderController;
|
||||
use App\Http\Controllers\WebhookController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Payment Routes
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Route::prefix('payment')->name('payment.')->group(function () {
|
||||
Route::get('/success', [PaymentController::class, 'success'])->name('success');
|
||||
Route::get('/cancel', [PaymentController::class, 'cancel'])->name('cancel');
|
||||
|
||||
// Payment processing endpoints
|
||||
Route::post('/checkout', [PaymentController::class, 'createCheckout'])->name('checkout');
|
||||
Route::post('/subscribe', [PaymentController::class, 'createSubscription'])->name('subscribe');
|
||||
Route::get('/methods', [PaymentController::class, 'getPaymentMethods'])->name('methods');
|
||||
Route::get('/history', [PaymentController::class, 'getHistory'])->name('history');
|
||||
});
|
||||
|
||||
Route::prefix('webhook')->name('webhook.')->group(function () {
|
||||
// Unified webhook handler
|
||||
Route::post('/{provider}', [WebhookController::class, 'handle'])->name('unified');
|
||||
|
||||
// Individual provider handlers (for direct provider-specific webhooks)
|
||||
Route::post('/stripe', [WebhookController::class, 'stripe'])->name('stripe');
|
||||
Route::post('/lemon-squeezy', [WebhookController::class, 'lemonSqueezy'])->name('lemon_squeezy');
|
||||
Route::post('/polar', [WebhookController::class, 'polar'])->name('polar');
|
||||
Route::post('/oxapay', [WebhookController::class, 'oxapay'])->name('oxapay');
|
||||
Route::post('/crypto', [WebhookController::class, 'crypto'])->name('crypto');
|
||||
|
||||
// Legacy route for backward compatibility
|
||||
Route::post('/payment/{provider}', [PaymentController::class, 'webhook'])->name('payment');
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Payment Provider Management Routes
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Route::prefix('providers')->name('providers.')->group(function () {
|
||||
// Provider status and configuration
|
||||
Route::get('/', [PaymentProviderController::class, 'index'])->name('index');
|
||||
Route::get('/{provider}', [PaymentProviderController::class, 'show'])->name('show');
|
||||
Route::post('/{provider}/test', [PaymentProviderController::class, 'test'])->name('test');
|
||||
Route::post('/{provider}/toggle', [PaymentProviderController::class, 'toggle'])->name('toggle');
|
||||
Route::put('/{provider}/config', [PaymentProviderController::class, 'updateConfig'])->name('update.config');
|
||||
Route::post('/refresh', [PaymentProviderController::class, 'refresh'])->name('refresh');
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Activation Key Routes
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Route::prefix('activation-keys')->name('activation-keys.')->group(function () {
|
||||
Route::post('/redeem', [PaymentProviderController::class, 'redeemActivationKey'])->name('redeem');
|
||||
Route::get('/validate/{key}', [PaymentProviderController::class, 'validateActivationKey'])->name('validate');
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Crypto Payment Routes
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Route::prefix('crypto')->name('crypto.')->group(function () {
|
||||
Route::get('/rates/{crypto}', [PaymentProviderController::class, 'getCryptoRate'])->name('rates');
|
||||
Route::get('/convert', [PaymentProviderController::class, 'convertUsdToCrypto'])->name('convert');
|
||||
});
|
||||
Reference in New Issue
Block a user