Shopping api written with Python and APIFlask. This api implements:
- User registration
- Token authentication
- Product creation(admin only)
- Cart creation
- Adding product to the cart
- Product purchases with Stripe Checkout
- OpenAPI specification
- Clone this repository:
git clone https://github.com/lymagics/shop-api.git
- Go to project directory and create python virtual invironment:
cd shop-api
python -m venv venv
- Activate virtual environment and install requiremenst:
venv/Scripts/activate
pip install -r requirements.txt
- Go to stripe checkout, create account and get stripe secret key.
- Create .env file and fill it with .env.example variables. Dismiss STRIPE_WEBHOOK_SECRET for now.
- Apply database migration:
flask db upgrade
- Populate database with purchase statuses:
flask populate statuses
- Run flask local server:
flask run
- Run ngrok:
ngrok http 5000
- Go back to stripe checkout, go to dashboard and create webook with your ngrok url.
- Complite .env file with STRIPE_WEBHOOK_SECRET.