This repository implements payment processing and order management features in a Django project, based on Chapter 9 of Django By Example. It demonstrates how to integrate Stripe for credit card payments, manage order statuses, export order data in CSV format, and generate PDF invoices dynamically.
- Stripe Payment Gateway Integration: Secure credit card payments.
- Order Management: Track and mark orders as paid.
- Payment Notifications: Handle Stripe webhooks.
- Admin Enhancements:
- Export orders to CSV.
- Custom admin order detail view.
- Generate PDF invoices dynamically.
- Celery & RabbitMQ: Handle asynchronous tasks such as sending invoices.
git clone https://github.com/your-username/your-repo.git
cd your-repo
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
pip install -r requirements.txt
Create a .env
file and configure the following variables:
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_PUBLIC_KEY=your_stripe_public_key
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
- Visit
http://127.0.0.1:8000/
to browse the shop. - Add products to the cart and proceed to checkout.
- Use Stripe's test card
4242 4242 4242 4242
(expiry: any future date, CVV: any 3 digits) to simulate payments. - Access the admin panel at
http://127.0.0.1:8000/admin/
to manage orders.
- Django 5
- Stripe API
- Celery & RabbitMQ
- Django Admin Customization
- CSV & PDF Generation
This project is based on the implementation from Django By Example and follows its licensing terms.
Feel free to contribute or modify as needed!