Have you ever wanted to create an app in which the users would have to pay a few one-time fees and have a periodic subscription as well? On the one hand, you’d like to keep as much information as needed to have control over your customers and their payments. On the other hand, credit cards data are really sensitive, and storing them in your database would be very risky.
Fortunately, there’s a very interesting solution. Integrating your app with Stripe will save you time and provide a really clean and safe payment process. With its extensive API, you’ll be able to implement any type of money transaction you can imagine, and, moreover, all sensitive data will be secure in the Stripe cloud.
For the purpose of this article, we’ll create a simple app using the Django REST framework for our API back end and React for the front-end side.
Seems quite simple, doesn’t it? So let’s start!
Assume we’ve already created a Django project called StripeApp
with the Django REST framework library installed.
StripeApp
project rootpython manage.py startapp payments
Our project structure should look like that (make sure you have the files with bolded names, and create missing ones, if needed):
- StripeApp/
- payments
- migrations/
- __init.py__
- admin.py
- apps.py
- models.py
- tests.py
- urls.py
- views.py
- stripeapp/
- __init.py__
- settings.py
- urls.py
pip install --upgrade stripe
#stripe #react #python #javascript #programming