Free Django eCommerce - Use Products from Stripe
Tags: webdev, ecommerce, django, stripe
Published: 2022-10-26 07:43:49

---
title: Free Django eCommerce - Use Products from Stripe
published: true
description: Mini eCommerce for Django with products download from Stripe - Open-source project (MIT License).
tags: webdev, ecommerce, django, stripe
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wmgibre8nh5u5lzhaj79.jpg
canonical_url: https://blog.appseed.us/django-ecommerce-download-products-from-stripe/
---
Hello coders!

This article presents an open-source [Django & Stripe Mini eCommerce](https://github.com/app-generator/sample-django-stripe) 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](https://github.com/app-generator/sample-django-stripe) - `source code`
- 🚀 Free [support](https://appseed.us/support/) via Email & Discord (just in case)

{% embed https://www.youtube.com/watch?v=qP3QGkvBq74 %}

---

## ✨ 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](https://github.com/app-generator/sample-django-stripe)

```bash
$ 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

```bash
$ python -m venv env
$ source env/bin/activate
$ pip install -r requirements.txt
```

---

> 👉 **Step #3** - Migrate the database & Create a Superuser

```bash
$ 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

```env
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 

![Django eCommerce - Stripe Dashboard (free product)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/97df126y1liztmt99cdi.png)

---

Before import, the app warns the users to authenticate and add more products using a superuser account.   

![Django & Stripe - Missing Products Warning.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jol9oruth64hbqe4auhr.png)

---

In the page, reserved for superusers, if the configuration is correct, the information from Stripe becomes available and editable. 

![Django eCommerce - Information pulled from Stripe.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8jq7b1jynzl8kvlj4ds4.png)

---

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: 

![Django & Stripe eCommerce - Payment Flow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ci1stjfm8hkb0gjyrxs8.gif)

---

The sample used in the video demonstration can be found on GitHub with all the products already downloaded from Stripe:

{% embed https://github.com/app-generator/mini-ecomm %}

---

> `Thanks for reading!` For more tools and support feel free to access:

- 👉 More [Developer Tools](https://appseed.us/developer-tools/) provided by `AppSeed`
- 👉 Free [support](https://appseed.us/support/) via Email & Discord (just in case)