Anvil: Web apps with nothing but Python Transcripts
Chapter: Ecommerce and accepting payments
Lecture: Connecting our Stripe account

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Here we are in our Anvil app
0:01 and we want to add Stripe checkout for when we click
0:04 this button we charge $9.99.
0:07 In order to do that we have to add the Stripe service.
0:10 We have users, Google API for login data tables
0:14 now we're going to need to add Stripe down here.
0:16 In order to use this you're going to have
0:18 to have a Stripe account.
0:20 You don't technically, in the early testing have
0:23 to have a bank account or anything that will make
0:26 information linked to that Stripe account.
0:29 Just have to create it.
0:30 So I've created a separate test Stripe account I'm
0:34 going to use here that is not tied
0:36 to my business Stripe account.
0:38 I don't actually want those things anywhere near
0:40 each other so I'm going to do a quick login
0:42 and then we'll carry on.
0:43 So either you create an account or you login
0:47 with an existing account. Perfect, so I've logged in, no big deal to that.
0:49 Just click the add my current account, went over
0:53 through OAuth and logged in at Stripe and
0:56 then it came back here.
0:58 Now it says we're in test mode and absolutely
1:00 we want to be in test mode we don't want to have actual
1:03 charges attempted here and stuff.
1:05 There's actually a bunch of test credit cards that
1:07 signify different scenarios.
1:10 What does it look like if I want
1:12 to have a successful charge?
1:13 What if I want to have an invalid CVV?
1:15 What if I wanted to have an expired card
1:17 declined payment, a fraudulent card?
1:19 All those kinds of things.
1:20 Go in test mode we can test that and then flip
1:22 it to live if we were a real app.
1:25 This is just a demo so we're never ever going to do that.
1:28 Anyway it shows us that the code down here is pretty simple.
1:32 So we got to do that and then we'll be in good shape.
1:37 So this is our first step here to do what we want
1:41 with Stripe is to just have this connected
1:43 the service added, and we're going to use this code
1:46 so I'm going to go ahead and copy and paste
1:49 and edit it because it's exactly what we want.