WEBVTT 00:01.320 --> 00:07.620 So this time around, we want to adjust the way that the price is displayed on our widget page because 00:07.620 --> 00:13.350 right now it's displaying one thousand, which is 1000 cents or ten dollars, and we want that to show 00:13.350 --> 00:15.870 up the way that a customer would expect it to appear. 00:15.900 --> 00:16.710 And that's really easy. 00:16.890 --> 00:20.200 So let's go back to our code and let's do a couple of things. 00:20.230 --> 00:25.710 So right now, I'm looking at the buy once page Jorgo HTML and I'm going to delete this comment it out 00:25.710 --> 00:26.370 amount. 00:26.910 --> 00:32.250 But you will notice before I do it that that actually has the idea of amount which I neglected to put 00:32.250 --> 00:33.690 on my hidden amount field. 00:33.690 --> 00:34.610 So I'll have to add that. 00:34.620 --> 00:35.640 So let's delete this. 00:36.750 --> 00:43.500 Let's add the actual I.B. here, Heidi, equals come out and we want that because over in our stripe, 00:43.500 --> 00:44.610 just partial. 00:45.210 --> 00:47.560 We're actually looking for that right here in my code. 00:47.580 --> 00:49.200 It's online 48. 00:49.230 --> 00:51.340 We're getting element by ID amount. 00:51.360 --> 00:54.130 So if we didn't do that, we wouldn't be able to charge a credit card. 00:54.840 --> 00:55.810 So that's the first thing. 00:56.400 --> 01:01.320 The second thing we want to do is to write a simple little function that will format currency the way 01:01.320 --> 01:01.920 that we want. 01:01.920 --> 01:04.650 And I'm going to do that in my render Dongo file. 01:05.640 --> 01:10.530 So in rendered ogo, we have this variable and in my code it's on the line twenty five. 01:10.530 --> 01:13.590 It's a template funk map and it's empty right now. 01:13.620 --> 01:15.270 So what we'll do is very simple. 01:15.450 --> 01:21.620 We'll create a new function, call that function func format, currency. 01:22.050 --> 01:27.900 It will take one parameter which I'll call and it's an end and four number and it will return a string. 01:29.220 --> 01:33.720 And all we have to do to make this work is to create a variable which I'll call for float. 01:33.960 --> 01:42.720 That's assign the value of cast to float thirty two and I'm going to cast and divide it by one, which 01:42.720 --> 01:45.770 should give me exactly what I want for a float value. 01:45.780 --> 01:53.790 And then we'll just format or return from the format package as print F and we'll use the format string 01:53.790 --> 01:53.970 of. 01:54.000 --> 02:05.070 I'll start with a dollar sign then I'll put in percent dot to F to F so to two decimal places with a 02:05.070 --> 02:05.970 dollar sign in front of it. 02:06.330 --> 02:12.470 And my substitution is just F so that is the function, but it's not used. 02:12.480 --> 02:13.940 So we'll add that to the folk map. 02:13.950 --> 02:20.010 So I'll click in between the curly brackets here return and I simply in my template I'll call the function 02:20.010 --> 02:30.990 format currency and that has the value of format currency and ended with a comma and no parentheses 02:31.170 --> 02:33.910 and now that should be available to my functions. 02:33.930 --> 02:41.610 So let's make sure everything recompile it did OK and let's go to our template by once page HTML. 02:42.570 --> 02:47.970 Let's find out where we're printing the price and instead call that function and we'll just call. 02:50.490 --> 02:53.910 Format, currency. 02:56.010 --> 03:02.550 And it expects an end and that's an it, so let's make sure everything recompile looks like it did. 03:02.640 --> 03:03.210 Let's find out. 03:03.660 --> 03:09.940 So back to my Web browser, reload this page and now it shows as ten dollars. 03:10.030 --> 03:12.810 OK, so that's just a little bit of cosmetic change. 03:12.810 --> 03:18.210 But it was absolutely critical because I don't want people to not buy my widget because they think it's 03:18.210 --> 03:19.050 a thousand dollars. 03:19.980 --> 03:20.440 All right. 03:20.460 --> 03:25.500 In the next lecture, we'll start working on getting a transaction through.