Laravel Stripe Integration (3D Secure Processing)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today we are going to learn stripe implementation in laravel uh we will understand 3d payment processing using stripe we are going to use laravel cashier to achieve this and using laravel cashier we will understand how stripe 3d processing work so let us see how it works for that first we will create a fresh laravel project which is using this command okay i already have this project so this is giving me an error otherwise it would creative for you and inside this we will install laravel cashier composer require level cashier command so once you do that it will install the laravel caching package for you i already have it installed on my computer so i'm not gonna reinstall it but just to give you an idea once we do that we will open our code in our code editor and then get this key and secret value from our stripe dashboard we'll set the currency to euro this is the logging mechanism for cashier if you're using any other model uh other than the the laravel's default user model then you need to set it although i've set it in spite of the fact that i am using the default model but this should give you an idea in case if you are using a separate model then you should set it up here and then we will create two routes here one to show the payment form and the other one to process it let us see the payment form here uh it's a basic very basic form uh we have this card holder name we have this payment method and we have this div i have created in which this type will automatically create the credit card number month year uh cvv code fields we could have done that done it uh on our own but it's advisable to use the default because uh stripe handles a lot of things for you in the back end without you knowing it so it's advisable to use this kind of auto creation of card number field and month and year field and cvv fields below that we have stripe library included here this is coming from the environment variable that we had set up in our env file and then we have we are creating the card number cbv field month and year field in this card element tip that we have here and then cardholder name is being picked up from this input field and then we are creating this form javascript object which is picking up the form with this id stripe id here and now we are handling the submit event here now here if there is an error then we will display the error to the user otherwise we will process it now if everything goes well then we should be getting this payment method dot id from stripe if the card verification was successful there and what we will do is we will put this value this payment method dot id value in this p method element which we had created on top here it's a hidden field we don't want to show it to the user and then we will submit it when the form is submitted we will handle it in our controller and as you can see i have not included the csrf token just for the sake of simplicity and i have created an exception in verify csr of token middleware so we are going to process it i have created a a user a dummy user in my database and you can do the same just for the sake of testing but in real time you would want to pick this user information from the login user session uh now this function charges the user and this in this is the input that we have created here and the value was set from here if the user's card has been not 3d secured then they should work however in some cases and the basic purpose of this video is to show how we handle 3d secure payment mechanism and in order to do that in case uh if the 3d secure is enabled then the you you'll probably see this incomplete payment exception and we are handling the same exception here in case if if that happens we will redirect the user to this cashier route you don't have to worry about that it is provided by default once you install the cashier package on your computer and then we are redirecting the user to this uh root with these variables i have also included this exception incomplete payment exception on top so that we don't face any error and now let us see how it works on the browser you i'll input my name then we will check the stripe 3d test cards okay here then you scroll down find out the 3d card okay so here we have 3d secure is required now i'll copy this paste it here one thing uh that i would like you to notice is that we have not created this uh credit card field this month year cvv zip field it is automatically created by stripe and you can see it has automatically detected that this card that we have entered is the visa card so it's important uh you can customize it using some custom css on your own but for the sake of simplicity we are not going to do that at this point of time now i'll click on this payment process button as you can see it has redirected me to stripe payment url which is coming from laravel cashier package so i'll confirm it you should read this in live mode the customer will be asked to verify that identity with a push notification a text message or another method chosen by the bank if we click on complete we see that the payment was successful and the same can be checked on your stripe dashboard um in in the live environment uh you would probably want to store uh this payment successful information in your database and i would leave that to you and i would i would say you go ahead google it find it how you can get those information and store it in the database for now uh this tutorial ends here and i would like to thank you for watching this video and if you like this video please subscribe to my channel to stay updated for more similar updates similar videos thank you bye
Info
Channel: Rakesh Kumar
Views: 3,238
Rating: undefined out of 5
Keywords: laravel stripe, stripe 3d secure, laravel cashier, stripe strong customer authentication, laravel stripe sca
Id: iqbmU-hkd6o
Channel Id: undefined
Length: 10min 13sec (613 seconds)
Published: Fri Apr 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.