Requirements
- Python: 3.7 or higher
- pip: Latest version recommended
- Virtual Environment: Recommended for isolation
Installation
Virtual Environment Setup
We strongly recommend using a virtual environment:- venv
- virtualenv
- conda
Environment Setup
1. Get Your API Key
- Log in to the InventPay Dashboard
- Navigate to Settings → API Keys
- Create a new API key
- Copy the key (you’ll only see it once!)
2. Store API Key Securely
Create a.env file in your project root:
.env
3. Load Environment Variables
Install python-dotenv:Framework-Specific Setup
Django
1
Install Package
2
Add to settings.py
settings.py
3
Create Client Service
payments/services.py
4
Use in Views
payments/views.py
Flask
app.py
FastAPI
main.py
Async Support
The SDK supports both synchronous and asynchronous usage:Verification
Verify your installation by creating a simple test:test.py
Troubleshooting
ImportError: No module named 'inventpay'
ImportError: No module named 'inventpay'
Cause: The SDK is not installed or not installed in the active Python environment.Solution:
AuthenticationError: Invalid API key
AuthenticationError: Invalid API key
Cause: Your API key is incorrect or not loaded properly.Solution:
- Check that your
.envfile contains the correct API key - Ensure you’re loading environment variables with
python-dotenv - Verify the API key in your Dashboard
- Make sure you’re using the correct environment (test/live)
SSL/TLS errors
SSL/TLS errors
Cause: Python SSL certificates are not properly configured.Solution:
Type hints not working
Type hints not working
Cause: IDE may not recognize type hints.Solution:
Async client not working
Async client not working
Cause: Missing async dependencies.Solution:
Requirements File
For production deployments, create arequirements.txt:
requirements.txt
pyproject.toml for modern Python projects:
pyproject.toml
