The checkout process will work as follows:
- Add items to the shopping cart
- Check out the shopping cart
- Enter credit card details and pay
We are going to create a new application to manage payments. Create a new application in your project using the following command:
python manage.py startapp payment
Edit the settings.py file of your project and add the new application to the INSTALLED_APPS setting as follows:
INSTALLED_APPS = [ # ... 'payment.apps.PaymentConfig',]
The payment application is now active.
After clients place an order, we need to redirect them to the payment process. Edit the views.py file of the orders application and include the following imports:
from django.urls import reversefrom django.shortcuts ...