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 and we want to add Stripe checkout for when we click this button we charge $9.99.
0:08
In order to do that we have to add the Stripe service. We have users, Google API for login data tables now we're going to need to add Stripe down here.
0:17
In order to use this you're going to have to have a Stripe account. You don't technically, in the early testing have
0:24
to have a bank account or anything that will make information linked to that Stripe account. Just have to create it.
0:31
So I've created a separate test Stripe account I'm going to use here that is not tied to my business Stripe account.
0:39
I don't actually want those things anywhere near each other so I'm going to do a quick login and then we'll carry on.
0:44
So either you create an account or you login with an existing account. Perfect, so I've logged in, no big deal to that.
0:50
Just click the add my current account, went over through OAuth and logged in at Stripe and then it came back here.
0:59
Now it says we're in test mode and absolutely we want to be in test mode we don't want to have actual charges attempted here and stuff.
1:06
There's actually a bunch of test credit cards that signify different scenarios. What does it look like if I want to have a successful charge?
1:14
What if I want to have an invalid CVV? What if I wanted to have an expired card declined payment, a fraudulent card? All those kinds of things.
1:21
Go in test mode we can test that and then flip it to live if we were a real app. This is just a demo so we're never ever going to do that.
1:29
Anyway it shows us that the code down here is pretty simple. So we got to do that and then we'll be in good shape.
1:38
So this is our first step here to do what we want with Stripe is to just have this connected the service added, and we're going to use this code
1:47
so I'm going to go ahead and copy and paste and edit it because it's exactly what we want.