WEBVTT

00:03.700 --> 00:05.200
Hey there, everyone that they share.

00:05.200 --> 00:09.280
And in this video we're going to work through with the Razer pay, we've already gone through with a

00:09.280 --> 00:12.010
quite in-depth detail about the Razer pay once already.

00:12.010 --> 00:13.870
So it's time to speed up the things.

00:13.870 --> 00:19.240
So the very first thing that I would know is go ahead and sign up on the Razer pay of course, and then

00:19.240 --> 00:20.020
into the settings.

00:20.020 --> 00:23.470
We need the API keys, so go ahead and grab your API keys.

00:23.470 --> 00:31.930
I'll add new variables into this one so I'll just call them as simply razer pay.

00:31.930 --> 00:34.330
And the first one is actually just the key.

00:34.330 --> 00:36.640
So let's call this also as API key.

00:37.060 --> 00:39.130
So this is razorpay pay API key.

00:39.130 --> 00:42.640
And then we have got similarly the razer pay secret.

00:42.640 --> 00:44.560
So razer pay secret.

00:45.220 --> 00:45.820
There we go.

00:45.820 --> 00:47.650
Secret always remains with us.

00:47.680 --> 00:49.780
API key can go and travel.

00:49.780 --> 00:55.510
So in case you want to get that anyways via a method or anyways it's all okay.

00:55.540 --> 00:58.060
Let's go ahead and regenerate the key.

00:58.090 --> 01:01.150
Yes, please deactivate my old key and generate.

01:01.150 --> 01:02.320
So this is my ID.

01:02.350 --> 01:03.640
Go ahead and copy that.

01:03.640 --> 01:07.870
And of course by the time you will be getting these files, they all will be deactivated and won't be

01:07.870 --> 01:09.070
usable anymore.

01:09.100 --> 01:13.030
I'm going to go ahead and copy The Secret and there we go.

01:13.030 --> 01:13.840
So both are there.

01:13.840 --> 01:15.640
I'm going to go ahead and save that now.

01:15.640 --> 01:16.810
I don't need to download that.

01:16.810 --> 01:17.410
Okay.

01:18.560 --> 01:18.950
Okay.

01:18.950 --> 01:19.920
So this is all done.

01:19.940 --> 01:22.820
Now let's go ahead and take a look on how the documentation works.

01:22.850 --> 01:27.080
In fact, first, what we can do is we can actually create a similar method to what we have done in

01:27.080 --> 01:28.480
the sense trip key.

01:28.490 --> 01:33.380
So in fact, we can actually copy this and make another method that hey, this time we are going to

01:33.380 --> 01:37.970
send razorpay ki razorpay ki.

01:38.210 --> 01:43.290
Now again, it's not something that we should be doing, like it's not necessary, but still, let's

01:43.290 --> 01:47.810
just say somebody is demanding instead of saying that, hey, just get it again and again, we're going

01:47.810 --> 01:49.550
to go ahead and give him like the method.

01:49.970 --> 01:50.480
There we go.

01:50.480 --> 01:51.590
That's all it takes.

01:51.770 --> 01:57.170
Now, we are going to go ahead and duplicate this method one more time so that we can actually create

01:57.170 --> 02:00.680
a method for capturing a payment with the stripes.

02:00.680 --> 02:06.470
So we're going to go ahead and copy this, paste this here, and this time this one is going to be CAPTCHA

02:06.470 --> 02:07.910
razorpay payment.

02:09.820 --> 02:11.800
Razer pay payment.

02:12.070 --> 02:17.050
Okay, we can just go ahead and remove all of this and we can bring in some code from the one that we

02:17.050 --> 02:18.040
saw previously.

02:18.040 --> 02:21.730
So go into the documentation of razor page, just click on the view documentation.

02:21.730 --> 02:26.410
It will take you to the documentation again, the documentation for payment gateways and all of that.

02:26.410 --> 02:29.740
It has a lot of things to work on with that and you can click on that.

02:29.740 --> 02:35.020
So this is the slash doc slash payments and pretty easy way to find the documentation in fact.

02:35.170 --> 02:39.040
And we are interested in creating an order and we'll be creating an order.

02:39.040 --> 02:41.890
So of course creating an order via the API itself.

02:42.340 --> 02:44.160
So this is all what we need to take.

02:44.170 --> 02:48.160
Go ahead and scroll it a little bit and you're going to find that you can pass on a whole lot of things

02:48.160 --> 02:49.240
that you want to.

02:49.240 --> 02:54.610
But we are interested in just creating an order via the code itself and we'll be looking for the Node.js.

02:54.610 --> 03:01.060
Let's go ahead and bring in all of this data and copy that and let's move up here and paste this up

03:01.060 --> 03:01.510
here.

03:01.540 --> 03:02.040
Okay.

03:04.190 --> 03:06.220
Let's go ahead and hit an enter here.

03:06.230 --> 03:11.030
And in fact, I would love to create an enter just right here.

03:12.940 --> 03:13.500
There we go.

03:13.510 --> 03:16.180
Now it needs an ID as well as a secret.

03:16.180 --> 03:18.040
So let's go ahead and give it that.

03:18.340 --> 03:21.160
We can actually bring this one guy from here.

03:21.160 --> 03:23.500
So process e v dot razer pay key.

03:23.500 --> 03:24.910
So let's copy that.

03:25.330 --> 03:31.720
This is my key id or the key itself and the last one is the secret.

03:31.720 --> 03:34.600
So I'm going to go ahead and bring that from Razer pay secret.

03:35.170 --> 03:36.220
Copy that.

03:37.400 --> 03:38.660
And pace them up here.

03:38.660 --> 03:44.220
So as just like the documentation instructed to us that go ahead and create an instance of the razorpay.

03:44.240 --> 03:45.290
We have done that.

03:45.290 --> 03:49.490
Now we have got these options that how you are going to go ahead and accept the options up here.

03:49.490 --> 03:53.630
So we're going to go ahead and say, hey, I have an option of requesting this.

03:53.630 --> 03:59.480
So this one is going to come up as request, dot body, dot amount.

03:59.930 --> 04:00.180
Okay.

04:00.290 --> 04:02.030
Now coming up is the receipt.

04:02.030 --> 04:07.700
So you can actually go ahead and use that asset like this or we can go ahead and generate a random number

04:07.700 --> 04:08.480
all the time.

04:08.480 --> 04:13.010
And in case you do remember, we have the way of generating the random number in the user controller,

04:13.010 --> 04:15.020
not controller, the model itself.

04:15.170 --> 04:20.420
So in the user model we saw that how we can actually go ahead and generate it's kind of a similar token

04:20.420 --> 04:21.020
up here.

04:21.020 --> 04:24.050
So we're going to go ahead and call this one as token.

04:24.050 --> 04:29.630
So let's go ahead and bring this one so that it gives us this same kind of a token or we can use actually

04:29.630 --> 04:32.960
a UUID better approach would be to create.

04:32.960 --> 04:35.720
In fact, let me just show you and you can do this later on.

04:35.720 --> 04:36.920
I wouldn't be doing this.

04:36.920 --> 04:40.370
So let's go ahead and we can actually use that part as well.

04:40.550 --> 04:48.440
This is just a just a kind of order received and you can use a nano ID in this case and then the ID

04:49.790 --> 04:53.000
and nano ID.

04:53.030 --> 04:54.770
I hope this can search it.

04:54.770 --> 04:55.520
There we go.

04:55.520 --> 05:01.760
So what nano ID can do it for you is give you some of the random string and your your invoice is going

05:01.760 --> 05:02.780
to look like this.

05:02.780 --> 05:05.660
I'm not interested in generating the invoice as of now.

05:05.660 --> 05:07.580
So this is already being too much of work.

05:07.580 --> 05:09.410
I am pretty sure you can go ahead and do that.

05:09.410 --> 05:12.620
So we're going to go ahead and create these options.

05:12.620 --> 05:16.160
And once these options are done, all I'm interested in capturing the order.

05:16.160 --> 05:22.040
So instead of saying that, hey, go ahead and instance, dot order, dot create, let's hold this into

05:22.040 --> 05:24.680
a variable and not pass on a function like this.

05:24.680 --> 05:31.910
So we're going to remove this function entirely and there we go, just like that and pass on the option.

05:31.910 --> 05:35.210
And let's hold this into a variable, this entire response that is coming up.

05:35.210 --> 05:41.060
So we're going to call this one as simply my order and this one is going to take some time.

05:41.060 --> 05:42.680
So let's go ahead and await this one.

05:42.680 --> 05:46.520
Once this is all done, let's go ahead and send this my order on the different end.

05:46.520 --> 05:50.960
And maybe whoever the guy is handling the front end can actually extract what comes back into the order

05:50.960 --> 05:51.650
itself.

05:51.650 --> 05:54.140
So let's go ahead and say it as status.

05:54.560 --> 05:59.540
The status is obviously going to be 200 and then we are going to go ahead and send a JSON response like

05:59.540 --> 06:00.020
this.

06:00.110 --> 06:04.160
And in this, we are going to go ahead and say success is true.

06:04.700 --> 06:09.080
And we can also optionally send that whatever the amount we have captured.

06:09.080 --> 06:13.730
So amount can actually be coming from request, dot, body, dot amount.

06:13.730 --> 06:19.250
Maybe he wants to further down the road that confirm that whatever the amount was captured or not.

06:19.250 --> 06:22.280
And finally, we want to pass on this order as well.

06:22.280 --> 06:25.580
So order is going to be my order.

06:25.580 --> 06:26.210
There we go.

06:26.210 --> 06:30.140
And we can actually just pass on this response to this guy as well.

06:30.140 --> 06:36.140
Maybe somebody wants to do a further thorough check that whether all the values are being getting properly

06:36.140 --> 06:36.770
or not.

06:37.070 --> 06:37.340
Okay.

06:37.370 --> 06:41.060
So that's all it takes to work on with the payment gateways, that's all.

06:41.060 --> 06:41.750
Pretty much it.

06:41.750 --> 06:46.820
In the next video we'll be creating routes for them and we'll be injecting these routes into the app

06:47.210 --> 06:48.140
is pretty simple.

06:48.140 --> 06:49.940
Let's go ahead and catch up in the next video.
