Hello! This article presents an open-source Django & Stripe Mini eCommerce starter that builds product pages using the information saved in Stripe Dashboard. Once the Stripe Secrets are provided in the
.env file, the superusers are able to pull the products from Stripe and edit the information via a simple UI. The sources, released under the MIT License, can be used in commercial projects and eLearning activities. Thanks for reading!
- 👉 Django & Stripe eCommerce - source code
- 👉 Django & Stripe eCommerce - YouTube presentation
- 🚀 Free support via Email & Discord (just in case)
✨ How it works
The sources come with a default product, saved in the local filesystem. If the user initiates the purchase, the application warns that the Stripe Secrets are not provided and the flow cannot continue. The steps, as explained in the video, are the following:
👉 Step #1 - Clone the source code from the public repository
$ git clone https://github.com/app-generator/sample-django-stripe.git $ cd sample-django-stripe
👉 Step #2 - Follow up the usual set up for a Django Project
$ python -m venv env $ source env/bin/activate $ pip install -r requirements.txt
👉 Step #3 - Migrate the database & Create a Superuser
$ python manage.py migrate # migrate DB $ python manage.py createsuperuser # create the app King
👉 Step #4 - Create
.envfile in the root of the project
DEBUG=True SECRET_KEY=WhateEver_KEY STRIPE_SECRET_KEY=<FROM_STRIPE> STRIPE_PUBLISHABLE_KEY=<FROM_STRIPE> # Server Address (used by Stripe callback) # Should be the URL used to start the APP DOMAIN_URL=http://localhost:8000/
The most important settings are the Stripe Secrets that will authorize the payment flow using Stripe as the payment provider. The values can be found on your Stripe Dashboard and the newcomers should use the "TEST" mode during the tests.
env file is edited and saved, we can safely start the project and import the data from Stripe using a simple UI.
👉 Stripe Dashboard - Three products
Before import, the app warns the users to authenticate and add more products using a superuser account.
In the page, reserved for superusers, if the configuration is correct, the information from Stripe becomes available and editable.
For each product, all product fields are editable using a minimal UI: price, name, description, and IMAGES. A live payment flow should look like this:
The sample used in the video demonstration can be found on GitHub with all the products already downloaded:
Thanks for reading! For more tools and support feel free to access: