What happens after you click “pay”?

Jen Person
Google Cloud - Community
3 min readFeb 18, 2020
What does managing payments have to do with socks? Tune in to this blog post series to find out!

Series Table of Contents

  1. Setting up inventory
  2. Setting up inventory — the code
  3. Incorporating Stripe
  4. Incorporating Stripe — the code
  5. Checkout the Checkout
  6. Checkout the Checkout — the code
  7. Setting up the website
  8. Setting up the website — the code

Managing payments in your app: What happens after you click “pay”?

You can buy pretty much anything on the internet these days. I can get my groceries delivered. I can hire someone to come put my IKEA furniture together. I can buy Rubik’s cube and a book explaining how to solve a Rubik’s cube. What a time to be alive!

Do you ever think about what happens when you click “pay” on that website or app? How does your credit card information get transmitted in a way that pays for your pizza delivery while ensuring that info can’t be intercepted? If you opt to save your credit card info on a website, where does that info live? No? You don’t think about that? Well, I do so strap in and listen up!

So you want to get paid

According to the internet search I just did, Confucious once said “Do what you love, and you’ll never work another day in your life”. But apparently Marc Anthony and Mark Twain also said that…? Well, now I just said it so you can quote me. The thing is, if you want to continue to do that work you love, you do in fact need to get paid for it. Fortunately, there are plenty of options for payment processing APIs. There are at least as many options as there are people to whom the above quote is attributed to. I’m going to show you one such option: an end-to-end payment processing journey using Stripe and Cloud Platform.

Payments with Stripe

You may be wondering, why am I choosing Stripe for this example? At first, the choice was rather random and primarily based on the fact that we had an existing sample using Stripe and the Realtime Database that I tweaked to use Cloud Firestore. Developers seem to like Stripe and it worked well for me. But after publishing blogs and giving a talk on payments, I connected with some folks at Stripe who helped me ensure that my code follows best payment practices. I’d like to pass that knowledge along to you, gentle reader.

Stripe brings the infrastructure needed to move money on the Internet but what about the remaining infrastructure we need to run our business and our website.

So what does Stripe have to do with Cloud Platform? I’m so glad you asked [and I’m sure you did]!

Everything else with Cloud Platform

There’s a good chance that you’ll want to store more information about your users than just their payment methods. For example, a clothing store app may want to store which items are currently in your cart so you can see them from wherever you log in. A scheduled service like lawn mowing will need to store calendar information so the landscapers and customers both know when they will mow. That’s where Cloud Platform comes in handy. Cloud Platform is so many things, but if I had to boil it down to a sentence I definitely didn’t take from the documentation, I’d say it’s a suite of secure storage, powerful compute, and integrated data analytics products. Here are the products I’ll be utilizing in my example:

Prerequisites

If you’d like to build the project along with me, you’ll need a few things:

  • An intermediate level experience with JavaScript
  • An IDE of your choice
  • A Google Cloud Platform project with billing enabled
  • A Stripe account

Let’s go!

With the prerequisites out of the way, we’re ready to get started! Our first step is to set up shop. Find out how in the next blog post, Setting up inventory!

--

--

Jen Person
Google Cloud - Community

Developer Relations Engineer for Google Cloud. Pun connoisseur.