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:06 we said well, let's make sure that we can actually charge some money for this thing. So we said there's a lot of credit card options out there,
0:13 Stripe is one of the easiest, most widely accepted and really respected ones out there.
0:20 And if you want to get started quick and in a really smooth, short, checkout flow this checkout is actually really amazing.
0:28 So we said look, all we have to do to use checkout is to come over here and basically add this form, this script to our page.
0:35 So we're going to include the checkout javascript and then this little bit of HTML.
0:40 Notice we're passing our key, things like how much we want to charge them, the name of the thing that we're charging them,
0:46 and then when they click on the button that appears here, it's just going to pop up this single dialogue
0:52 you enter four pieces of information, hit the button and boom, it's done, that's the entire check out flow; but the card is not charged yet.
1:01 Stripe comes back to you and it posts to one of your methods the user doesn't really see this, but after Stripe has already verified
1:10 that it would be ok to do this, you get this Stripe token passed to you. So when the Stripe token comes in then you have to take this
1:18 and actually go to the Stripe API in Python, go to this charge class and create one. If that works okay, then you record it, you give them aces
1:27 to whatever they were going to buy; if it doesn't, you record the error and you send them some kind of message.
1:32 By this point, it's mostly gone through the verification process once that little Stripe check out dialogue goes away
1:38 you're like 90 percent there, but there is a possibility of some kind of error, so be sure to work with this carefully.

Talk Python's Mastodon Michael Kennedy's Mastodon