Stripe checkout and webhook

This commit is contained in:
Matt Young 2026-01-29 21:54:18 -06:00
parent 30dddcf725
commit f626157ab4
3 changed files with 16 additions and 6 deletions

View File

@ -11,8 +11,12 @@ return Application::configure(basePath: dirname(__DIR__))
health: '/up', health: '/up',
) )
->withMiddleware(function (Middleware $middleware): void { ->withMiddleware(function (Middleware $middleware): void {
// $middleware->validateCsrfTokens(except: [
'stripe/webhook',
]);
}) })
->withExceptions(function (Exceptions $exceptions): void { ->withExceptions(function (Exceptions $exceptions): void {
// //
})->create(); })->create();

View File

@ -35,4 +35,9 @@ return [
], ],
], ],
'stripe' => [
'secret' => env('STRIPE_SK'),
'webhook_secret' => env('STRIPE_WEBHOOK_SECRET'),
],
]; ];

View File

@ -17,13 +17,14 @@ Route::middleware(['auth', 'verified'])->group(function () {
Route::view('invoices', 'invoices.index')->name('invoices'); Route::view('invoices', 'invoices.index')->name('invoices');
Route::get('invoices/{invoice}/edit', Route::get('invoices/{invoice}/edit',
fn(Invoice $invoice) => view('invoices.edit', compact('invoice')))->name('invoices.edit'); fn(Invoice $invoice) => view('invoices.edit', compact('invoice')))->name('invoices.edit');
Route::get('invoices/{invoice}', CustomerInvoiceController::class)->name('invoices.show');
Route::view('payments', 'payments.index')->name('payments'); Route::view('payments', 'payments.index')->name('payments');
}); });
// Testing Stripe Route::get('invoices/{invoice}', CustomerInvoiceController::class)->name('invoices.show');
Route::get('stripe', [StripeController::class, 'index'])->name('stripe.index');
Route::post('/checkout ', [StripeController::class, 'checkout'])->name('stripe.checkout');
Route::get('/success', [StripeController::class, 'success'])->name('stripe.success');
// Stripe
Route::get('stripe', [StripeController::class, 'index'])->name('stripe.index');
Route::post('/stripe/checkout ', [StripeController::class, 'checkout'])->name('stripe.checkout');
Route::get('/success', [StripeController::class, 'success'])->name('stripe.success');
Route::post('stripe/webhook', [StripeController::class, 'webhook'])->name('stripe.webhook');
require __DIR__.'/settings.php'; require __DIR__.'/settings.php';