From 32d5ff0edbc74d7d5703f78f7b8567f69671ba6d Mon Sep 17 00:00:00 2001 From: Hritikkk9 Date: Wed, 3 Jul 2024 16:15:19 +0530 Subject: [PATCH] webhhhookk kernal --- app/Http/Kernel.php | 8 ++++++++ routes/web.php | 9 ++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index aa49ddf..569dc4b 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -43,6 +43,14 @@ class Kernel extends HttpKernel \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], + + 'webhook' => [ + \App\Http\Middleware\EncryptCookies::class, + \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, + \Illuminate\Session\Middleware\StartSession::class, + // Do not include the VerifyCsrfToken middleware here + \Illuminate\Routing\Middleware\SubstituteBindings::class, + ], ]; /** diff --git a/routes/web.php b/routes/web.php index 11c6544..1537e11 100644 --- a/routes/web.php +++ b/routes/web.php @@ -32,10 +32,13 @@ use App\Http\Controllers\Admin\ManageRulesController; //webhook // Route::post('/stripe-webhook', [StripeWebhookController::class, 'handleWebhook']); -Route::post('/stripe/webhook', [StripeWebhookController::class, 'handleWebhook']); -Route::get('stripe-webhooks', [StripeWebhookController::class, 'getWebhook']); - +// Route::post('/stripe/webhook', [StripeWebhookController::class, 'handleWebhook']); +// Route::post('/stripe-webhooks', [StripeWebhookController::class, 'getWebhook']); +Route::middleware('webhook')->group(function () { + Route::post('/stripe/webhook', [StripeWebhookController::class, 'handleWebhook']); + Route::post('/stripe-webhooks', [StripeWebhookController::class, 'getWebhook']); +}); //stripe webhook end