Python for Entrepreneurs Transcripts
Chapter: Course Conclusion
Lecture: Lightning review: Credit cards

Login or purchase this course to watch this video and the rest of the course contents.
0:01 Once we had our site up and running on the internet, in production,
0:05 we said well, let's make sure that we can actually charge some money for this thing.
0:09 So we said there's a lot of credit card options out there,
0:12 Stripe is one of the easiest, most widely accepted
0:16 and really respected ones out there.
0:19 And if you want to get started quick and in a really smooth, short, checkout flow
0:24 this checkout is actually really amazing.
0:27 So we said look, all we have to do to use checkout is to come over here
0:31 and basically add this form, this script to our page.
0:34 So we're going to include the checkout javascript and then this little bit of html.
0:39 Notice we're passing our key, things like how much we want to charge them,
0:43 the name of the thing that we're charging them,
0:45 and then when they click on the button that appears here,
0:48 it's just going to pop up this single dialogue
0:51 you enter four pieces of information, hit the button and boom, it's done,
0:56 that's the entire check out flow; but the card is not charged yet.
1:00 Stripe comes back to you and it posts to one of your methods
1:04 the user doesn't really see this, but after Stripe has already verified
1:09 that it would be ok to do this, you get this Stripe token passed to you.
1:13 So when the Stripe token comes in then you have to take this
1:17 and actually go to the Stripe API in Python, go to this charge class and create one.
1:22 If that works okay, then you record it, you give them aces
1:26 to whatever they were going to buy;
1:28 if it doesn't, you record the error and you send them some kind of message.
1:31 By this point, it's mostly gone through the verification process
1:34 once that little Stripe check out dialogue goes away
1:37 you're like 90 percent there, but there is a possibility of some kind of error,
1:41 so be sure to work with this carefully.