Routes
Routes
You need to create route groups: one for the initiation entry point (GET), and one for Bkash callbacks (POST). The callback routes must exclude CSRF verification because Bkash posts to them from its servers.
Routes/web.php
You need to add the following routes to your web.php file:
bash
use App\Http\Controllers\PaymentController;
Route::prefix('payment')->name('payment.')->group(function () {
Route::get('/', [PaymentController::class, 'showForm'])->name('form');
Route::post('/initiate', [PaymentController::class, 'initiatePayment'])->name('initiate');
Route::get('/callback', [PaymentController::class, 'callback'])->name('callback');
Route::get('/success', [PaymentController::class, 'success'])->name('success');
Route::get('/cancel', [PaymentController::class, 'cancel'])->name('cancel');
Route::get('/failed', [PaymentController::class, 'failed'])->name('failed');
Route::get('/ipn', [PaymentController::class, 'ipn'])->name('ipn');
Route::get('/refund', [PaymentController::class, 'refund'])->name('refund');
});