How to integrate flutterwave v3 payment gateway in PHP

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone i will be showing you how you can implement a filter with version theory payment system into your php project so i'll be taking you to the documentation where i'm going to guide you how you can easily implement this gateway into your system we will be making use of the floater with standard the fruit away standard competition here it asks us to send the request to our request to this endpoint and ask us to send all these posts so this post we will be taking them one after the other so first thing i have to do is i'll go go to my visual studio code i already created a little form out here which i can easily take a payment informations so this is my form i created and is the good so i'll just take the email and the amount is trying to pay then the sub in button then in the p way i'm sending this form to i'm sending the form to peter speedy and his paid of speech view i was able to retrieve the requests i'm getting from the form right here so our community make use of them this way we are going to be calling our filter with payment system so the next thing is to collect the payments gateway so indeed in this below code i was able to grab all these requests one after the other year if you check i was able to get this um txf record then the amount the currency symbol so the ts record should be unique and i'm using time then the next thing is amount the amount is coming from the form the currency is uh nga then the payment option is cut it associates the payment option different options which can be cut or bank anyone doing the payment plan we don't need payment plan data is when the payment has been completed we are going to delete it you are so the united unreal is on process.php is where i'm going to check transaction with it here it's going to php then the customers informations so the customers ask us to get the email the phone number is optional and then the name which i'm usually getting right here i get the email the email coming from the form then the name is your customer name i just input myself the meta tag is the additional information you want to send to the payment it is used for sending eating datas which you can easily use afterward so i'm sending the product pricing here i will show you how you can use this method tag information then the customizations is the title uh middle sticker it should be the title this was titled title because this can be your company name then the descriptions the descriptions of the payment informations if you find how you gonna describe the parent information so i input a sample word and put a sample word in here so we are done collecting the payment in an array function the next thing is to send it to to filter with endpoint points so i have prepared a great request here which i'm going to grab it i'll be preparing queer requests so i'm going to grab this request end point right so excuse me um the next thing down the our curryware is the filterwave endpoint and this is our endpoint here he asks us to send the payment request to this endpoint i'm going to copy this url then i copy this url and i replace it with this and our method should be post the post and then field is request we're actually preparing right here so we have to convert this into a g sum we convert this array into a json how we are going to do that so we're gonna use the php button function to convert that request into a json so i'm gonna say json and code and variable request to request the array actually processing yeah or this we converted into json then our authentication barrier this should be our secret key i have my secret key here your secret key so i will try to copy that then i will replace it i'll i'm going to replace it with this then the contact type of application again json then execute this url close it if you you are going to try to test this and actually so you are getting so i'm going to make this json a very pretty i'm going to pretty print it very pretty so i could pray so my json can be in the readable format okay if you try to send this we'll be getting some json response if i get additional response that we are able to call the fruitar wave endpoint successfully so let's try that i'm going to refresh my browser then i'm going to input my email then i'm going to send 1000 error then i click on set what do i get okay let's see the status is success then the message is hosted link and the link is this this is where we are trying redirecting our user to this the link payment link if you try to copy this into a browser then paste it right here you notice a payment page is going to be opening so we're trying to open a payment can page see that so after we have called our input we need to redirect to this link to make the user complete payment so this payment page is really going to redirect in the user actually our core dryer is successfully working the next thing is to extract this payment page out so you have to extract this payment paid out and the direct user to it but before i'm going to do that we're going to check if the status is success then we extract this prevent page and redirect our user to big payment so the next thing is you know say so i'm going to say variable words you say custom json and decode my decoding and decoded usbs okay so if if vaporize if we raise an array if we respond i will status let me just use normal according so it's gonna be the status if we raise our status it's equal to is equals to what we got if reversal status is equals to success okay if respondent status is caused to success that means our api code was successfully then we need to redirect the user to this link so they can make payments and then we are going to use on variable link it's equal to favorites and then the data should be sorted data under link okay it should be data then the link then enter okay so then the location should be what variable link of it else we can just echo a negative what we say echo we cannot process your payments good stuff so let's try this again unless what is happening into our end so i'm gonna return back i have to refresh this then i started i try again and i'm gonna send 1000 then what do i got all right as you can see we're able to redirect the user to the payment page this is where they are going to make the payments so one thing i want to show you is that if a user is a because this payments page is they actually go to this process dot php this is where we have to check the status of our request when it's coming back from the filter web page so let me try that if i try to cancel this payment page and where did it go to it went to low cost and they went to process that php which is actually this speech but it's actually showing the sample of cancel is the reason the status is a coastal castle so and we see if so i'm gonna call it phpa let's see if it sets let's go to superglue baguette let's forget about get what am i going to get so i'm going to get these turtles you see what we will get as status then this is status okay so it's going to do something then let's check payments status so if you've set spargo bucket and then status is equal to if you see super good gator now [Music] okay sorry i made a mistake then okay i'm gonna say we will status sorry if we will get then the status is it goes to cancel as you can see in the url it shows the signs of cancer country damaged image was canceled by the user so you have to check if the image is cancelled then if the payment is cursive you have to fall back the user and let's say echo you can sell this limit you can sell this payment or we should just return the user back to researcher in this page so you can make the payment again let's start let's do that so i can just return the user i can say header then i will say location i'll consider occasion then let's see it should go back to index get that location just go back to the index i'm gonna see index.php effects if i try to refresh i will define should we index is he said because the weather i'm going to get this should be status so let's try to copy that and i'm going to replace it [Music] okay this should be get outpost we should get not post so i'm going to try that oh sorry we are actually using a folder metal engineering folder here so we just go to let's go back to index you just have to go back to index all right so i'm gonna send this again you just have to return back to this index.php i'm going to try to cancel that then we were coming back to our index.php diamond point image has been canceled okay now let's try and get another payment status the payment is successful so in this stage i'm going to complete this payment then i'm gonna send that while this page is loading i'll just get the rough test cards so i'll just get my rough test you can see that i need to make payments and press experience here so we are going to use this card i'm gonna copy this card then i paste it in 25 entities should be the file date should be 0 9 32 0 9 32 and it cost me 5 6 4 okay gb 5 6 4. then i set it up then our password is oh i have a very slow network on my side i don't know what's happening today so i'm going to click ok then the password one two three four five all right say one two three four i've been testing that before okay now you can see our status change to successful are able to get the transaction wave and the transaction id that means our status was successful not cancelled now we cannot go ahead and verify this transaction we think we have to verify this transaction then if this status is going to cancel x x else if let's use else if free will get get and then the status is equals to what status is it goes to what if this is equal to success that means a transaction was respond with a successful transaction then we can now go ahead and continue processing their payments so the next thing is to validate let's try videos please don't just give it time in this page you need to actually find these payments rav or something like that yeah source by verifying transactions you see transaction verification so we have to call this endpoint again and i'm trying to check that it asks us to actually find this transaction we can even check the php code he says she said queen request to this endpoint then find the transaction so i'm going to grab this code i'm going to grab this code for verification then i will send a query request here all right you have already put the endpoint for the our end point is the transaction id the actual transaction [Music] the transaction id is going to three four damage the transaction id this idea transaction id which is the numpy x so we have to be getting that i was going to get that in our code so i will say reboot cx id is equal to get so i have to get a transaction id then i'm going to get the transaction id okay i'm going to copy that then i pass it into my index so we are now getting a transaction id which we can easily utilize into the code we can replace this with transaction 90. so i'm going to say variable t x i t now we apply transaction id for the draft of verify so the authentication parameter is our secret key we have used the secret key here so i'm going to get that actually get my secret key [Music] i'm going to replace it with this code here so my secret key okay so now is to record the response so we can actually see the information we're sending so again i am going to echo in a pretty print so i can easily read that then echo pretty it's returning json it's going to come back in json and okay so echo um okay let me sometimes what we are getting here all right there's an error or defined variable say well oh okay we did not call our ceo all right then you can just see using the sample code mission i wanna see if we will see your hour it's because we'll see uh innate url in it so i'm gonna try to refresh the page okay perfect so you can see we are verifying the transaction successfully and the right standard that transaction has been received then dom ignores ignore this first line is to tell you that the request was sent success the transaction was fetched successful do the transaction price is 1000 and the currency is entering then the charge amount is where we are going to come down the actual chart is equal to the actual amount we want the users to pay this is in this case we saw something called meta and the price is one thousand then the next thing is to check if this actual amount that we are installing in this process we store the method in this so that i told that time we are going to use it to compare the price of the amount you receive and the amount the user paid so this is what they're doing to compare this price and the charge amounts if this charge amount is greater than or because of this price then you can continue and give item the next thing is to break this down into an array so you can install this in our php so i'm going to do that it's still the same as what we do or pop off so i'm going to break into the json then panasonic rest is a constitution and the code variable response okay so let's check if the transfer if these cr requests were successful then i'm going to say if fibroids and the status when i get to the stators from i'm trying to fetch this request status so if the requisite status is because the success okay so if the equator is a cost of success then we're gonna proceed with the checking or else i'll stay just echo can not assess payment okay all right they are going to break into these datas then we are going to make use of all the property to actually use what we are getting then in this case we have to check we have to check for the actual amount you considered process response was successful but ignore that we want to check if this amount is actually the same as this amounts then i'm going to create a variable i will say amount speed i want pete is equals to variable response then my variable response we go into the data go into the data then inside the data you have to go into the charge amount you have to go into the charge amount that's it i'm actually getting the amount the user paid you can continue storing this into the database then i want to pay amounts to pay is the amount we are storing for the method so it should be requests a response sorry then the data then inside the data i've actually located this method this method then this method and then what the method amount finding the price is in this price here we said that when i want to process the payment so this is the price now the next thing is to check if this amount is greater than helicopter this amounts so if variable amount paid is greater than or equal to variable amount to p okay that means the the customer pay the actual amount we are expecting then echo limit successful remain successful otherwise that means if the amount is greater than or less than that's amount before transaction so we're gonna say echo fraud let's say fraud transaction detected for transaction detected mistaking that fraud transaction detected so i'm going to try to refresh this page and what do i got okay remain successful that means the amount the amount the user the amount of minimum price is among the user base so in this process you cannot continue to give item continue to give to give item to the user so that's it we have integrated payment system then continue to give right then the user then we are able to collect payments send payment to the filter within validates and verify the transaction so it's a simple as simple as that i'm going to leave resource code in your website where you can easily get that then as it's as simple as that it's just a minutes minute so able to integrate the full payment system if you want to find more and interact more then you can also check request you can store all these transactions in the database if you're actually looking to make a returning payment i mean to auto charge the card using the tokenized payment you can actually use make use of this payment then the user will not need to be inputting the card anymore you can making repayments to make it continuous baby that's why this token there's the process called tokenized swimming you can check the documentation for that so thank you very much for watching the video and i will see you next time
Info
Channel: Zubayr Ganiyu Seun
Views: 4,105
Rating: undefined out of 5
Keywords:
Id: LvtgfxfYPxA
Channel Id: undefined
Length: 25min 57sec (1557 seconds)
Published: Tue Dec 29 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.