- Install Razorpay SDK:
composer require razorpay/razorpay
- Create Model, Controller, Migration, Service, etc.
- Update your
.env
with the following values.
# Razorpay
RAZORPAY_KEY=
RAZORPAY_SECRET=
- Open
config/services.php
and add the below at the end of the array.
'razorpay' => [
'key' => env('RAZORPAY_KEY', ''),
'secret' => env('RAZORPAY_SECRET', ''),
],
- Have your routes like this.
// Payment
Route::post('/create-order', [PaymentController::class, 'createOrder']);
Route::post('/verify-payment', [PaymentController::class, 'verifyPayment']);