WEBVTT 00:01.950 --> 00:03.700 So it's time to test the transaction. 00:03.720 --> 00:10.090 We have our currency showing our properly on the page and we're ready to actually try to run a transaction. 00:10.110 --> 00:14.880 So if you look at Stripe Dash, just partial, you'll see that I have a couple of mistakes. 00:15.300 --> 00:18.660 And I blame them on a lack of caffeine, but I make mistakes all the time. 00:18.990 --> 00:23.130 So the first one is right here on line sixty for I am fetching. 00:23.130 --> 00:28.160 And instead of putting the API in there, the route to the API, I have the publishable key. 00:28.180 --> 00:29.070 So let's get rid of that. 00:31.140 --> 00:37.050 And instead let's put an API, which we're getting from the render package right here as part of the 00:37.050 --> 00:37.890 default data. 00:37.890 --> 00:39.690 And we have it called API here. 00:39.770 --> 00:42.480 OK, so that's the first mistake. 00:42.480 --> 00:50.910 And of course that has to have some API payment dash intent after it because the API is just a localhost 00:50.910 --> 00:52.340 column, four thousand and one. 00:52.860 --> 00:55.770 So that's the first mistake and the second problem. 00:56.220 --> 00:59.670 I just transpose these, I put the API in the publishable key. 01:00.240 --> 01:09.660 Now if you go to our handlers and you look at virtual terminal right now, I'm handing that to the virtual 01:09.660 --> 01:12.120 terminal using a string map and that works. 01:12.690 --> 01:18.870 But down here in this handler, I'd also have to hand that to this charge once, page. 01:18.870 --> 01:21.900 And if I have to do it twice, chances are there's an easier way to do it. 01:22.530 --> 01:29.400 So what I'm going to do is delete this out of here, which means I'm not handing any data to this template 01:29.400 --> 01:33.420 at all so I can delete everything inside the curly brackets after a template data. 01:33.820 --> 01:37.170 OK, and instead I'll add that to my default data. 01:37.170 --> 01:38.850 So it's available any time I want. 01:39.060 --> 01:45.300 So let's get rid of these blank spaces and let's go to render Dutko and add two new fields here. 01:45.670 --> 01:54.190 I'll call the first one stripe secret key, which would be a string and also have not string supercute 01:54.210 --> 01:55.400 stripe secret key. 01:57.450 --> 02:05.910 And I'll also have stripe publishable key which will also be a string OK and a formatters. 02:06.540 --> 02:13.350 And then down here in the add default data I'll just populate that on every request stripe. 02:13.350 --> 02:19.710 Secret key will be equal to app dot config dot straight dot. 02:19.720 --> 02:21.030 And this is the secret key. 02:21.050 --> 02:28.250 So I want the secret and then I'll popularity dot stripe publishable key which will be equal to update 02:28.290 --> 02:32.280 config dot stripe dot key there. 02:32.550 --> 02:36.450 Now if this is decompiled and it did that's good. 02:36.810 --> 02:40.530 That means I need to go back to just partial and fix this. 02:40.710 --> 02:48.030 And here I want the stripe publishable key, which is now available any time I want it straight publishable. 02:48.360 --> 02:48.720 She. 02:49.790 --> 02:54.930 OK, so let's save this, make sure it compiled and it did. 02:55.340 --> 03:06.260 Let's go back to our Web browser, reload this page, go to the console, clear the console, and let's 03:06.260 --> 03:07.330 try running a transaction. 03:07.430 --> 03:11.750 So cardholder name, Jack, nimble cardholder email. 03:11.870 --> 03:19.070 Jack, that nimble dot com and credit card is our standard visa that always passes. 03:19.300 --> 03:20.390 Let's see if we got this right. 03:22.130 --> 03:22.970 Twenty nine. 03:22.970 --> 03:23.780 Three, three, three. 03:24.900 --> 03:26.250 OK, so we'll charge the card. 03:30.510 --> 03:35.880 And they're so we've got a transaction going through now, we're not done yet, but we've actually successfully 03:35.880 --> 03:38.750 charged our test credit card on our test stripe account. 03:39.870 --> 03:47.100 So if you think this through, we actually don't want to just put this payment succeeded form up. 03:47.220 --> 03:49.370 We actually want to do more on the back end. 03:49.650 --> 03:55.050 We actually want to store the transaction in the database and we actually want to pull that widget out 03:55.050 --> 03:56.190 of the database as well. 03:56.190 --> 03:57.510 So there's more work to do. 03:57.900 --> 04:00.270 So we'll get started on that in the next lecture. 04:00.280 --> 04:05.250 But right now, we've managed to get this form working properly and corrected my goofy error that I 04:05.250 --> 04:10.270 made when I transposed the API and the secret key in straight charges. 04:10.290 --> 04:11.490 But everybody makes mistakes.