Python for Entrepreneurs Transcripts
Chapter: Making money (credit cards and businesses)
Lecture: Concept: Checkout JavaScript

Login or purchase this course to watch this video and the rest of the course contents.
0:02 Let's review what it took to get Stripe checkout integrated with our webpage.
0:07 Remember, all we really had to do was add a little bit of HTML
0:10 that referenced the checkout script, set some properties,
0:14 probably dynamically computed from our Chameleon templates,
0:18 and Stripe took care of the rest.
0:21 So here you can see we've got our form, we've put it onto our page
0:24 and this is actually the checkout code for the training website where you buy courses.
0:28 So, the action is /purchase/complete/${course.url}
0:33 because we need to figure out what course you purchased and then the source,
0:38 notice the HTTPS is highlighted to the Stripe js, it's really important
0:42 that this code runs on a page that is running over SSL so you don't get in a trouble,
0:46 and then you have to pass in your Stripe public key
0:50 and here we're grabbing it off the base controller
0:53 but in another example we just passed it as part of the dictionary,
0:56 we have to set the amount in cents and the default is US dollars in cents,
1:01 here we're setting the active email, so if you happen to be logged in,
1:05 then it will automatically prefill that, but you don't have to be,
1:10 it will just be empty and you fill it in, turn off "remember", set the name,
1:14 this is the name of the company you are buying it from, remember across the top,
1:17 we are also setting the data-image to set the picture, right, that's a little icon,
1:22 the little Talk Python To Me icon,
1:25 you want a label to say what it is you are buying
1:27 so buy the course for this price, and you also get a little bit longer description
1:31 but none of these get to be very long, so be sure to test them.
1:34 And that's it, you out this on your page, it's going to prefil and preload
1:39 and put a little button that will say whatever it says
1:42 in this case it will say "buy course for this amount of money", when they click it,
1:46 it's going to go through all the checkout process,
1:48 with the few things that you have there,
1:51 and finally if it does work correctly, it's going to post back to purchase/complete/url.
1:57 So you have this button, you'll be able to click it and when the user clicks it
2:01 you'll see something like this.
2:04 Really nice, we saw this form is quite smart,
2:08 it does a little wiggly animation to tell if the things are not right,
2:11 it's quite intuitive and friendly, and it's a very good purchase funnel
2:15 because there is very little to fill out here,
2:18 especially if your email is already prepopulated.