Build a Sales Page With Streamlit to Sell Digital Products
A Streamlit sales page for a digital product, with Stripe handling the payment. Create a Stripe payment link first, then build the page in one Python file: product description, buy button, features, demo video, FAQ and contact form, plus some CSS so it does not look like stock Streamlit.
Table of contents
Stripe payment link
A Stripe payment link is a hosted checkout page for one product, so the Streamlit app never touches card data and only needs a button that points to the link. Set it up before you write any code.
If you do not have an account yet, sign up at stripe.com. In the dashboard, open Payments, then Payment links, and click New. Choose Add a new product and enter the name and description; for the tutorial I used a small coffee donation. You can add an image and preview the checkout form on the right.
On the confirmation page tab, choose what buyers see after paying: a thank-you message, or a redirect to a page with the download link.

Project files
The app needs Streamlit and Pillow, which loads the product images. Install both from a terminal:
pip install streamlit pillow
In an empty project folder, create an assets folder with a product.png image, a styles folder with an empty main.css, and the main file streamlit_app.py. It is the same layout I use for a digital resume in Streamlit.
Imports and settings
The top of streamlit_app.py imports Path, Streamlit and Pillow’s Image, builds the paths to the assets and styles folders, and collects everything product-specific in one settings block.
from pathlib import Path
import streamlit as st # pip install streamlit
from PIL import Image # pip install pillow
The paths are relative to the Python file, so the app finds its files wherever it runs:
# --- PATH SETTINGS ---
THIS_DIR = Path(__file__).parent if "__file__" in locals() else Path.cwd()
ASSETS_DIR = THIS_DIR / "assets"
STYLES_DIR = THIS_DIR / "styles"
CSS_FILE = STYLES_DIR / "main.css"
The settings hold the Stripe payment link, the email address for the contact form, the demo video, and the product name, tagline and description. The description accepts Markdown, so bullet lists and bold text work:
# --- GENERAL SETTINGS ---
STRIPE_CHECKOUT = "https://buy.stripe.com/YOUR_PAYMENT_LINK"
CONTACT_EMAIL = "YOUREMAIL@EMAIL.COM"
DEMO_VIDEO = "https://youtu.be/YOUR_VIDEO_ID"
PRODUCT_NAME = "Excel Add-In: MyToolBelt"
PRODUCT_TAGLINE = "Ready To Become An Office Superhero? 🚀"
PRODUCT_DESCRIPTION = """
MyToolBelt saves every smart office worker time and effort when it comes to analysis with a unique set of tools you won't find anywhere else:
- Generate flawless Python code based on your cell selection
- Call Python scripts from Excel without having to lift a finger
- Create Jupyter Notebooks from Excel
- Add tickmarks to cells and highlight key areas
- Create an informative table of contents with ease
- ... and many more powerful features
**This is your new superpower; why go to work without it?**
"""
Page configuration
st.set_page_config sets the browser tab title and icon, the layout (wide or centered) and whether the sidebar starts collapsed. The small helper above it reads main.css and injects it into the page.
def load_css_file(css_file_path):
with open(css_file_path) as f:
return st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
# --- PAGE CONFIG ---
st.set_page_config(
page_title=PRODUCT_NAME,
page_icon=":star:",
layout="centered",
initial_sidebar_state="collapsed",
)
load_css_file(CSS_FILE)
Main section
The top of the page shows the product name and tagline, then two columns in a 2:1 ratio: the description and the buy button on the left, the product image on the right. The buy button is an HTML link to the Stripe checkout with the button class from main.css, which needs unsafe_allow_html=True.
# --- MAIN SECTION ---
st.header(PRODUCT_NAME)
st.subheader(PRODUCT_TAGLINE)
left_col, right_col = st.columns((2, 1))
with left_col:
st.text("")
st.write(PRODUCT_DESCRIPTION)
st.markdown(
f'<a href={STRIPE_CHECKOUT} class="button">👉 Get the add-in</a>',
unsafe_allow_html=True,
)
with right_col:
product_image = Image.open(ASSETS_DIR / "product.png")
st.image(product_image, width=450)
Features
The features come from a dictionary that maps each image to its heading and description. A loop shows them in two columns, image left and text right, so adding a feature means adding one dictionary entry. The video uses use_column_width=True for the images; current Streamlit versions removed that argument and show a warning box instead, so the code below uses width="stretch".
# --- FEATURES ---
st.write("")
st.write("---")
st.subheader(":rocket: Features")
features = {
"Feature_1.png": [
"Run Python Files From Excel",
"After locating your Python interpreter, you can execute Python files directly from Excel. In the Pro Version, you can also add several Python interpreter paths. This is helpful when you need to execute your Python code from different virtual environments.",
],
"Feature_2.png": [
"Create Pandas Dataframes",
"Generate Python files with a click of a button. Select the cell range you want to transform, and the add-in creates the Python code to read in the Excel data as a pandas dataframe.Instead of messing around with all of the available options in the pandas 'read_excel' method, the add-in does it for you.",
],
"Feature_3.png": [
"Create Jupyter Notebooks",
"Have you ever wanted to do some quick analysis of your Excel data in a Jupyter Notebook? MyToolBelt can convert an Excel cell range into a Jupyter Notebook. Just select the cell range, and the add-in will create a new Jupyter Notebook in the workbook's directory. Inside the Jupyter Notebook, you will find your ready-to-use dataframe based on your selection. This feature is a real time saver!",
],
}
for image, description in features.items():
image = Image.open(ASSETS_DIR / image)
st.write("")
left_col, right_col = st.columns(2)
left_col.image(image, width="stretch")
right_col.write(f"**{description[0]}**")
right_col.write(description[1])
Demo video
st.video embeds the demo from the DEMO_VIDEO setting, and it accepts a YouTube link as well as a video file.
# --- DEMO ---
st.write("")
st.write("---")
st.subheader(":tv: Demo")
st.video(DEMO_VIDEO, format="video/mp4", start_time=0)
FAQ section
The FAQ is another dictionary, of questions and answers. Each question becomes an st.expander, so the answers stay hidden until a visitor opens one.
# --- FAQ ---
st.write("")
st.write("---")
st.subheader(":raising_hand: FAQ")
faq = {
"Question 1": "Some text goes here to answer question 1",
"Question 2": "Some text goes here to answer question 2",
"Question 3": "Some text goes here to answer question 3",
"Question 4": "Some text goes here to answer question 4",
"Question 5": "Some text goes here to answer question 5",
}
for question, answer in faq.items():
with st.expander(question):
st.write(answer)
Contact form
Streamlit cannot send email by itself, so the contact form is plain HTML that posts to FormSubmit, a free service that forwards each message to the address in CONTACT_EMAIL. The first submission asks you to confirm that address.
# --- CONTACT FORM ---
# video tutorial: https://youtu.be/FOULV9Xij_8
st.write("")
st.write("---")
st.subheader(":mailbox: Have A Question? Ask Away!")
contact_form = f"""
<form action="https://formsubmit.co/{CONTACT_EMAIL}" method="POST">
<input type="hidden" name="_captcha" value="false">
<input type="text" name="name" placeholder="Your name" required>
<input type="email" name="email" placeholder="Your email" required>
<textarea name="message" placeholder="Your message here"></textarea>
<button type="submit" class="button">Send ✉</button>
</form>
"""
st.markdown(contact_form, unsafe_allow_html=True)
CSS
main.css styles the buy button (including a small bounce animation), the contact form fields, and hides Streamlit’s menu, footer and header. The complete file is in the GitHub repository; these are its main rules.
.button, .button:link, .button:visited {
font-size: 20px;
background-color: #f44336;
color: white;
padding: 14px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
border: none;
border-radius: 4px;
-webkit-animation: bounce .6s infinite alternate;
-moz-animation: bounce .6s infinite alternate;
animation: bounce .6s infinite alternate;
}
@-webkit-keyframes bounce {
to { -webkit-transform: scale(1.1); }
}
@-moz-keyframes bounce {
to { -moz-transform: scale(1.1); }
}
@keyframes bounce {
to { transform: scale(1.1); }
}
.button:hover, .button:active {
background-color: red;
}
/* Style inputs with type="text", type="email"and textareas */
input[type=text], input[type=email], textarea {
width: 100%; /* Full width */
padding: 12px; /* Some padding */
border: 1px solid #ccc; /* Gray border */
border-radius: 4px; /* Rounded borders */
box-sizing: border-box; /* Make sure that padding and width stays in place */
margin-top: 6px; /* Add a top margin */
margin-bottom: 16px; /* Bottom margin */
resize: vertical /* Allow the user to vertically resize the textarea (not horizontally) */
}
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
header {visibility: hidden;}
Theme
The colors come from a config.toml file in a folder named .streamlit next to the app. Restart the app after you change it.
[theme]
# Primary accent color for interactive elements.
primaryColor = "#F63366"
# Background color for the main content area.
backgroundColor = "#fff"
# Background color used for the sidebar and most interactive widgets.
secondaryBackgroundColor = "#F0F2F6"
# Color used for almost all text.
textColor = "#262730"
Deployment
Any host that runs Python can serve the page, for example Streamlit Community Cloud or Render. The live version of this page runs on Render, which can take a moment to wake up on the free plan.
I walk through the Render setup in deploying a Streamlit app to Render. If you want to charge a subscription for an app instead of selling a download, see building a SaaS with Streamlit.
