Saturday, September 24, 2022

Integrate Payumoney in Laravel (II) | Order Placement with Payumoney | Create Success / Fail Pages


In Part-162 of Advance E-commerce series, we will continue working on integrating Payumoney Payment Gateway in our website. In this video, we will make Payumoney dynamic with actual order. We will also work on Payumoney response. If user successfully makes payment then we will update the order status with "Paid" and will send order confirmation email to user. For getting Payumoney response after making transaction with test card, client need to register with PayUmoney website and can get credentials after activating the account. Recently PayUMoney has changed their process. This is for both production and sandbox. To start with website integration, we need an active account. So get your account activated. After that you can start integration. Once your account is active, you can test your integration code. It will work. You can start receiving payments as well. But in this video, we presume that our account has been activated by Payu and will add success condition to test it. 1) Update payumoneyPayment function We will update payumoneyPayment function to get the order details to return them to payumoney payment gateway. 2) Add Header Statements :- Add below statements at top of PayumoneyController to include Order model and Session :- use Session; use App\Order; Now actual order with order id and amount is going to Payumoney payment gateway. Now, we will work on Payumoney response. If user successfully makes payment then we will update the order status with "Paid" and will send order confirmation email to user. 3) Create Route :- We will create route for payumoney response in web.php file like below :- Route::post('payumoney/response','PaymentController@payumoneyResponse'); 4) Create payumoneyResponse function :- Now we will create payumoneyResponse function in which we will check payumoney response status is success or not. If success then we will update order with "Payment Captured" status and will send order confirmation email to user. And if fail then we will update order status to "Payment Fail". 5) Update indipay.php file :- We will resolve CSRF token error by update indipay.php file with response link payumoney/response as shown in video. 6) Create Routes for Payumoney success and fail pages :- Create Get route for Payumoney success and fail pages in web.php file like below :- // Payumoney Success Route::get('/payumoney/success','PayumoneyController@success'); // Payumoney Fail Route::get('/payumoney/fail','PayumoneyController@fail'); 7) Create success and fail functions :- Now create success and fail functions in PayumoneyController file :- 8) Create success.blade.php and fail.blade.php files :- Finally, we will create success.blade.php and fail.blade.php files in payumoney folder same like Paypal. Now we will test if payment is successful then payumoney success page will come and if payment fails then fail page will come. Join this channel to get complete sourc code: https://www.youtube.com/channel/UCExO...


No comments:

Post a Comment