• Created products and plans in Stripe (using their Dashboard)
  • Created my first Stripe promo code
  • Made my website always secure with https

Next steps:

  • Build server-side code to execute Stripe API (using Python)
  • Add promo code functionality to website

Issues I came across:

  • Question: Conceptually, I don’t understand how to send information from the Stripe HTML form to a Python file on my server.
  • Solution: Use Flask. It’s a ‘micro-framework’ that builds a connection between python files and HTML files. It’s a bit involved and requires some training to use.
  • Question: How do I create a Python file and store it on the server? Where do I store it on the server? I’m currently using Google App Engine.
  • Solution: Using the Flask framework, you’ll create a main.py file. In that file, you’ll be ‘rendering’ (pulling up) various HTML files to load. When a user goes to your website, it’ll first refer to this main.py file, basically as the index in a sense. There’s a specific folder format that Flask uses.
  • Question: Should it be in the same folder as index.html? What do I put in the html to connect to my Python file?
  • Answer: No, all HTML files should go in a templates folder, as per the requirements of using Flask. Take a look at the Google App Engine tutorial on building a web application using Python. 
  • Issue: I’m trying to get my website to go through HTTPS. There are a few tutorials, but none of them are successful yet.
  • Solution: Google App Engine automatically provides SSL certificates for the website. So, if I went to https://burningvpn.com, it will be secure. 
    • However, if the average user just types in burningvpn.com (with no https in front of it), it wouldn’t automatically re-direct to the https version. Thanks to Patrick for helping point this out to me. 
    • The solution was to build an automatic re-direct to https, so the website is always secure. We had to go to our app.yaml file (this file is, I think, the first point of contact when users go to burningvpn.com?). Here, it lists out where to find all of the relevant files needed for the website. 
    • Notice under the `url: /.*` section (the homepage), I added a `secure: always` line. I think this did the trick? Now, users are always redirected to the HTTPS page.
    • I followed the tutorial here: https://cloud.google.com/appengine/docs/standard/python/securing-custom-domains-with-ssl

Things I learned:

  • Stripe requires https to work. 
  • I successfully verified my domain address with Google App Engine. This required adding a few DNS entries.
  • Basic overview of how Stripe API works (2 steps):
    1. Collect payment details (credit card # and everything) via HTML. Here, Stripe will tokenize this information for us and send the token to our server, so we don’t have to deal with the actual credit card numbers. 
    2. Somehow send that data from the HTML form to our servers (Python file? PHP?), where we will make an API call, I think? To make the charge.
Ching Jui Uncategorized , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *