Flask Debugging Guide - Payment Integration
===========================================
Common Issues & Solutions
-------------------------
1. Payment Always Fails
- Cause: Wrong Paystack Secret Key
- Solution: Double-check .env file and ensure environment is loaded.
2. User Info Not Saved to DB
- Cause: Logic error in callback route or missing db.session.commit()
- Solution: Log the request data and ensure you commit the new user.
3. CSRF Token Missing
- Cause: WTForms CSRF not configured
- Solution: Set app.config['SECRET_KEY'] and use {{ form.hidden_tag() }} in
forms.
Logging Strategy
----------------
import logging
logging.basicConfig(level=logging.DEBUG)
Error Handling
--------------
@app.errorhandler(500)
def server_error(e):
return "An error occurred", 500