Free Django eCommerce - Use Products from Stripe
Mini eCommerce for Django with products download from Stripe - Open-source project (MIT License).
Hello coders!
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
โจ 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
.env
file in the root of the project
DEBUG=True
SECRET_KEY=WhateEver_KEY
STRIPE_SECRET_KEY=<FROM_STRIPE> # <-- MANDATORY
STRIPE_PUBLISHABLE_KEY=<FROM_STRIPE> # <-- MANDATORY
# 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.
Once the env
file is edited and saved, we can safely start the project and import the data from Stripe using a simple UI.
๐ Stripe Dashboard - With Three products defined
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 from Stripe:
Thanks for reading!
For more tools and support feel free to access:
- ๐ More Developer Tools provided by
AppSeed
- ๐ Free support via Email & Discord (just in case)