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

Talk Python's Mastodon Michael Kennedy's Mastodon