thetestcoder / laravel-razorpay
This is simple laravel package structure
Fund package maintenance!
thetestcoder
github.com/thetestcoder
Requires
- php: ^7.4|^8.0
- razorpay/razorpay: ^2.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.17
- orchestra/testbench: ^6.0|^5.0
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-12-28 17:17:18 UTC
README
Budge Goes Here
This package is under development so please use at your own risk
Installation
You can install the package via composer:
composer require thetestcoder/laravel-razorpay
Usage
RAZORPAY_API_KEY=your-api-key RAZORPAY_API_SECRET=your-api-secret
In Blade file
{!! \TheTestCoder\LaravelRazorpay\LaravelRazorpayFacade::paymentButton( 1000, "Pay 10 Rupees", "The Test Coder", "Order Value From Test Coder" ) !!} // or {{ \TheTestCoder\LaravelRazorpay\LaravelRazorpayFacade::paymentButton( 1000, "Pay 10 Rupees", "The Test Coder", "Order Value From Test Coder" [$id] # extra params for routes ) }}
Routes
Route::get('pay', 'YourController@payView')->name('pay.view'); // Payment Request Route::post('payment', 'YourController@payment')->name('payment'); // if you change name('your custom name') // please add extra .env value ===> RAZORPAY_PAYMENT_ROUTE_NAME=your-route-name // or Route::post('payment/{param}', 'YourController@payment')->name('payment');
YourController
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(); }); }
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email thetestcoder@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.