WEBVTT 00:02.480 --> 00:06.250 So before we go on to the next section, there's just a couple of things we need to clean up. 00:06.260 --> 00:12.320 So I'm looking at the terminal page dot go HTML file, and I'm in the JavaScript block at the bottom 00:12.320 --> 00:13.150 of the template. 00:13.160 --> 00:19.280 And right now we have our stripe publishable key hard coded into this template. 00:19.790 --> 00:26.600 In the same way, if you scroll down a bit where we have our fetch statement, I have the API URL hard 00:26.600 --> 00:27.830 coded into this as well. 00:27.860 --> 00:32.060 And of course, this is fine for development, but when we go to production, we're going to have a 00:32.060 --> 00:38.240 different URL and we probably don't want a hard code that publishable key into the template because 00:38.240 --> 00:42.590 we're using a test publishable key and we want our production key in there when we go live. 00:42.710 --> 00:43.770 So let's fix that up. 00:44.240 --> 00:51.770 So back in the render file render ago, we have this template data, which is data that's actually passed 00:51.770 --> 00:56.020 to any template and we also have this default data function. 00:56.030 --> 00:58.880 So let's take advantage of this and set a few things. 00:58.940 --> 01:05.240 So right now we have a member or a field in template data called API and that's the API URL. 01:05.840 --> 01:13.460 So I can add that in the default data function by saying something as simple as TD or API is equal to 01:13.460 --> 01:21.800 app DOT, Config API and now our API, which is set when we start the application, will be added in 01:21.800 --> 01:22.580 the same way. 01:22.700 --> 01:25.770 If we need to, we can actually add that publishable key. 01:26.210 --> 01:31.340 Now, if we wanted to, we could also add the publishable key as a field in this this type. 01:31.730 --> 01:34.590 But we also have this string that we can just take advantage of that. 01:34.940 --> 01:41.000 So if I open my roots file just so I can get where I need to be quickly and go to virtual terminal, 01:41.150 --> 01:43.010 I can click on that. 01:43.010 --> 01:44.090 And that brings me to this. 01:44.090 --> 01:48.520 And I can add that data right here like this. 01:48.530 --> 01:59.240 I can say string map is a sign the value of make a map, string, string, and then I can add a value 01:59.240 --> 02:00.740 to that string map. 02:04.310 --> 02:08.690 Publishable key is equal to 02:11.510 --> 02:15.040 app dot config dot stripe. 02:15.080 --> 02:16.280 I don't want the secret. 02:17.450 --> 02:18.140 I want the key. 02:20.280 --> 02:28.530 And I'll just pass that as data by putting a reference to template data and putting in a string map 02:29.100 --> 02:31.230 and making that string map. 02:32.660 --> 02:40.190 Now, I have that street map available in this template, so if I go back to the terminal page, I can 02:40.190 --> 02:41.600 replace this. 02:44.600 --> 02:54.950 I do eating it and just saying index dot, string map, publishable key. 02:58.870 --> 03:03.670 And that should substitute a publishable key right in there, if I got it right now, if we go back 03:03.670 --> 03:09.070 up here where we initialize this, we can simply delete this 03:11.860 --> 03:14.650 and put in the AP or. 03:16.790 --> 03:23.750 All right, so if we make sure that this has been recompile, it has and we go back to our Web browser 03:24.680 --> 03:25.970 and reload this page. 03:26.690 --> 03:28.060 Let's run a test transaction. 03:29.180 --> 03:40.340 So ten dollars me me at here for two four two four two four two four two four two zero one twenty nine 03:40.340 --> 03:41.990 three three three or four for four. 03:42.110 --> 03:46.940 And I'll open my JavaScript console just to make sure that we don't get any errors and try running this. 03:52.130 --> 03:58.730 And we got it, and that's much cleaner, so time to move on to the next section of the course, when 03:58.730 --> 04:03.860 we begin to make things a little more sophisticated, we add some database functionality and we'll start 04:03.860 --> 04:06.130 working on selling products online.