Other than the time issue, this should not be difficult to implement. Here’s an overview of a low-tech solution with 6 steps:
Create an SQLlite database with a login table (you can alternatively use something even simpler like pysondb if/as required)
Login table to contain required user details + userflag (for paid/unpaid) and startdt & enddt for subscription duration
User gets a screen to register (which does not contain userflag field). You could add your banking / wallet details herein
User to enter payment transaction id into registration screen, if they have paid. If this information is entered, the program should trigger an email to you / store that info into your database (which you can access periodically)
For all paid users, you update userflag & subscription period fields in the database via the backend using a dbbrowser / through a separate screen not available to general users
If a user tries to access paid info, the program checks the login table for userflag=paid and subscription period against current date, and shows paid data accordingly.
I’ve actually looked into this for my own app but since Streamlit receives all requests on one endpoint it’s a bit hacky to get it working. I thought it was possible to dive into the Tornado webserver and setup an extra endpoint next to it but it felt pretty cumbersome/messy with the Streamlit code everywhere.
To get the response from the payment processor(I’ve used both Stripe and Mollie) I’ve put down a simple Go API next to my Streamlit app to receive and write the response to the database which I check again in my Streamlit app whenever someone checks a specific page(specific content only shows if a certain flag has been set in the database which my Go code triggers on successful payment).
I’m still hoping Streamlit adds a Flask-like endpoint experience in the future though, for instance how we can use @st.cache now it would be amazing if we could decorate a function with @st.route(’/randomendpoint’, methods = [‘POST’, ‘GET’]) to route traffic to a specific part of the Streamlit app and redirect them to a specific endpoint.
Would be epic!
Hi everyone. it is the first time that I write in the forum. This topic interests me a lot. I have been using streamlit since its first release. After many attempts in trying to connect automated payment methods, via paypal or stripe, I realized that the best solution is another.
The app needs to be structured with both the free and premium version integrated. The difference will be a text input where whoever bought the code (via email, or automated checkout page, or via google forms) will unlock new features.
An example: I write an app that, given a photo as input, I apply the neural style transfer. Users who have not entered the premium code (which will be checked with streamlit secrets) will only see 3 possible applicable styles, while premium users will see 10 styles.
The possibilities are so many, let me know what you think.
I like the access code idea a lot! It would be very simple to implement.
How do you think you would prevent mass sharing of the access code? For example, how do you prevent the case of someone purchasing the access code and posting it online somewhere such as reddit? It all comes down to authenticating a user, curious on your thoughts!