PHP code example of thetestcoder / laravel-razorpay
1. Go to this page and download the library: Download thetestcoder/laravel-razorpay library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
thetestcoder / laravel-razorpay example snippets
php
public function payView()
{
return view('payment-page');
}
public function payment(Request $request)
{
return LaravelRazorpayFacade::payment($request)
->capture()
->redirectToRouteName('payment');
}
# also can do like this
public function payment(Request $request)
{
$razorpay = LaravelRazorpayFacade::payment($request)->capture();
return $razorpay->redirectIf($razorpay->payment->error_code === null, function () {
return redirect()->back();
});
}