1 00:00:01,070 --> 00:00:05,060 We've now got some code in place to make sure that we should accept the payment that the user is trying 2 00:00:05,060 --> 00:00:06,150 to provide to us. 3 00:00:06,200 --> 00:00:08,010 So we've done all these validation steps. 4 00:00:08,020 --> 00:00:08,930 It's now down here. 5 00:00:08,930 --> 00:00:13,100 We're going to try to take the token that was provided inside this initial request. 6 00:00:13,220 --> 00:00:16,960 Reach out to the stripe API and actually charge the users credit card. 7 00:00:16,970 --> 00:00:18,170 Let's first take a look at a diagram. 8 00:00:18,200 --> 00:00:22,550 Just help you understand exactly what's gonna go on with this step right. 9 00:00:22,550 --> 00:00:23,680 Here we go. 10 00:00:23,850 --> 00:00:28,850 We've got our payment service our ultimate goal is to reach out to the stripe API and charge the users 11 00:00:28,850 --> 00:00:30,520 credit card for some amount. 12 00:00:30,710 --> 00:00:35,840 At this point inside of our payment service inside that root HANDLER We just have a token which is an 13 00:00:35,870 --> 00:00:41,450 authorization to charge the user for some amount of money in order to actually charge the users credit 14 00:00:41,450 --> 00:00:42,040 card. 15 00:00:42,050 --> 00:00:46,130 We're going to install the node J.S. stripe SDK. 16 00:00:46,130 --> 00:00:50,690 So this is essentially an NPM module that has a little bit of code inside of it to allow us to very 17 00:00:50,690 --> 00:00:53,480 easily communicate with the stripe API. 18 00:00:53,480 --> 00:00:57,680 We're going to use this module and we're going to call a method inside there to charge the users credit 19 00:00:57,680 --> 00:00:57,980 card. 20 00:00:58,460 --> 00:01:03,620 When we do so we're going to provide the token that was included inside the request to our request handler. 21 00:01:03,620 --> 00:01:09,170 And we're also going to include an API key that is going to identify our application to the stripe API 22 00:01:10,730 --> 00:01:13,460 so to move forward we have to do two different things. 23 00:01:13,460 --> 00:01:17,980 We have to install the stripe SDK into our payments project. 24 00:01:17,990 --> 00:01:21,990 We also have to sign up for a stripe account and get an API key. 25 00:01:22,100 --> 00:01:25,080 So we're going to go through both those steps inside this video. 26 00:01:25,220 --> 00:01:29,940 Let's first install the stripe SDK back at my terminal. 27 00:01:30,020 --> 00:01:34,700 I'm going to change into my payments directory and then do an npm install stripe. 28 00:01:35,480 --> 00:01:42,350 That's pretty much it so I can run this command very small module should install rather quickly. 29 00:01:42,380 --> 00:01:43,990 That was easy enough. 30 00:01:44,000 --> 00:01:50,890 Next up we're going to go to the stripe Web sites sign up for an account and get an API key so to do 31 00:01:50,890 --> 00:01:59,080 so inside of a new browser tab I'm going to navigate to stripe dot com now just you know the stripe 32 00:01:59,110 --> 00:02:05,030 landing page and the documentation changes its look and theme rather frequently. 33 00:02:05,050 --> 00:02:09,280 So if you come to this page and it looks different than what I see that is totally ok. 34 00:02:09,540 --> 00:02:12,680 The stripe API itself rarely changes. 35 00:02:12,730 --> 00:02:15,350 It's actually pretty famous for being a rather stable API. 36 00:02:15,700 --> 00:02:19,930 So even if some stuff on this page looks a little bit different it's probably gonna be totally just 37 00:02:19,930 --> 00:02:25,710 fine because the API itself is pretty darn stable so once a year we're going to try to create a new 38 00:02:25,710 --> 00:02:26,650 account. 39 00:02:26,760 --> 00:02:32,130 You can either click on sign in on the top right or just click the green start now button. 40 00:02:32,280 --> 00:02:37,500 Well then sign up for a new account icon to create new account myself as well. 41 00:02:43,700 --> 00:02:45,910 And it does not like my password. 42 00:02:45,920 --> 00:02:46,400 There we go. 43 00:02:46,400 --> 00:02:53,790 Good enough. 44 00:02:53,800 --> 00:02:54,340 All right. 45 00:02:54,340 --> 00:03:03,350 There we go really demanding on that password so once we sign in for the very first time we'll come 46 00:03:03,350 --> 00:03:05,450 to a landing screen that looks like this. 47 00:03:05,460 --> 00:03:09,860 The only thing we really want to do right now is try to find our API key. 48 00:03:09,880 --> 00:03:14,370 The other thing we're going to have to do to see you know we have to verify our email address. 49 00:03:14,370 --> 00:03:16,120 Do you will want to open up your e-mail. 50 00:03:16,270 --> 00:03:18,220 You will get an e-mail from stripe. 51 00:03:18,220 --> 00:03:21,240 It's probably going to look a little something like this right here. 52 00:03:21,250 --> 00:03:23,040 So it says Just click this link. 53 00:03:23,170 --> 00:03:24,780 Just make sure you do exactly what it says. 54 00:03:24,790 --> 00:03:31,400 Just click on verify email address so once we have verified our account we're then going to either click 55 00:03:31,400 --> 00:03:33,790 on it get test API key is right here. 56 00:03:33,920 --> 00:03:40,250 If you do not see that link on the main page you can also find developers on the left tab click on developers 57 00:03:40,340 --> 00:03:42,590 and then click on API keys. 58 00:03:42,620 --> 00:03:47,720 Either way you will come to a page that looks like this and you're going to see a publishable key and 59 00:03:47,780 --> 00:03:52,080 a secret key so we're going to leave this page open for just a moment. 60 00:03:52,110 --> 00:03:56,130 We're going to take a pause right now and when we come back the next video we're going to set up the 61 00:03:56,130 --> 00:03:58,410 stripe SDK inside of our project.