Turn Your Streamlit App into a Subscription or a One Time Payment

Get Paid For Your Extra Contribution as a Data Scientist

Cover for Turn Your Streamlit App into a Subscription or a One Time Payment

If your Streamlit app is brining people value

why not monetize it?

You can bring in extra cash on the side from your extra contributions from your side projects.


Tyler Richards, a data scientist, faced the same problem,

and decided to help other data scientist by creating St-Paywall 

— a free proof of concept that allows you to add a subscription paywall to your Streamlit apps.


Earn from Your Streamlit Projects

Integrating a subscription model into your Streamlit app with st-paywall is straightforward. 

In just a few lines of code, you can restrict access to your app’s content, ensuring that only subscribers can view it. 

This allows you to monetize your data science projects without the need to create a complicated payment system.

How it works

st-paywall uses Stripe for payments and Google for authentication,

ensuring secure transactions and protecting your users’ data. 

It’s built to be user-friendly for data scientists who may not have much programming experience beyond Python.


Setting Up Stripe for Your Subscription Model

To integrate Stripe into your Streamlit app for subscriptions, follow these steps:

  1. Create a Stripe Account: Go to Stripe.com and sign up.

  2. Generate a Payment Subscription Link: After creating your account, make a payment subscription link (initially in test mode). Add this link to your app, typically in streamlit_app.py. Users will need to subscribe via this link before accessing the full app.

  3. Add the Subscription Link tosecrets.toml:
    stripe_link = 'https://buy.stripe.com/test_...'

  4. Create a Standard API Key: Go to Stripe API Keys to generate your API key. Save this key in your secrets.toml file as stripe_api_key. If you choose a restricted API key, ensure it has read permissions on Customers.

  5. Add the API Key tosecrets.toml:
    stripe_api_key = 'sk_...'


Testing Stripe Subscription in Streamlit

Initially, the repository uses test subscription links and API keys.

 When you’re ready to go live, create production links and API keys from your Stripe dashboard

You can use Stripe’s test cards during the testing phase.

Running in Test Mode

To test your setup, add the following to your secrets.toml:

  • testing_mode = true 

  • stripe_api_key_test = 'sk_test_...' 

  • stripe_link_test = 'https://buy.stripe.com/test_...'

Transitioning to Production

When ready to move to production, ensure Stripe redirects users back to your app after they subscribe. 

Edit your payment link on the payment links page, click ‘After payment’, and enter your app’s URL.

Unlock Steady Income by Monetizing Your Streamlit Apps with st-paywall

If you’re a data scientist aiming to generate income from your insights and tools, st-paywall provides an easy and efficient solution. 

By monetizing your Streamlit apps, you can earn a steady income from your passion projects while continuing to deliver value to your audience.

Want to turn your app into a full blown SaaS users love to use?

I have free templates here: vladshostak.com.

And offer free consultations here: DevSquadSix.

Share with your friends!

Level up your knowledge

The newsletter that helps you start & find your $50K per month software business

Join over 300+ founders. It’s completely free.