- Python 3
- Configured .env file
- Confirm
.envconfiguration
This sample requires a Price ID in the PRICE environment variable.
Open .env and confirm PRICE is set equal to the ID of a Price from your
Stripe account. It should look something like:
PRICE=price_1Hh1ZeCZ6qsJgndJaX9fauRl
Note that price_12345 is a placeholder and the sample will not work with that
price ID. You can create a price
from the dashboard or with the Stripe CLI.
Enabling Stripe Tax
In the server.py file you will find the following code commented out
# automatic_tax={'enabled': True},Uncomment this line of code and the sales tax will be automatically calculated during the checkout.
Make sure you previously went through the set up of Stripe Tax: Set up Stripe Tax and you have your products and prices updated with tax behavior and optionally tax codes: Docs - Update your Products and Prices
- Create and activate a new virtual environment
MacOS / Unix
python3 -m venv env
source env/bin/activate
Windows (PowerShell)
python3 -m venv env
.\env\Scripts\activate.bat
- Install dependencies
pip install -r requirements.txt
- Export and run the application
MacOS / Unix
export FLASK_APP=server.py
python3 -m flask run --port=4242
Windows (PowerShell)
$env:FLASK_APP=“server.py"
python3 -m flask run --port=4242
- If you're using the html client, go to
localhost:4242to see the demo. For react, visitlocalhost:3000.