This project implements a modular payments gateway that supports UPI and card payment flows. It is built using Flask and includes webhook handling and logging functionalities.
PayStack-Design-a-Modular-Payments-Gateway
├── src
│ ├── main.py
│ ├── payments
│ │ ├── upi.py
│ │ ├── card.py
│ │ └── __init__.py
│ ├── webhooks
│ │ └── handler.py
│ ├── logs
│ │ └── logger.py
│ └── utils
│ └── helpers.py
├── requirements.txt
├── README.md
└── .gitignore
-
Clone the repository:
git clone <repository-url> cd PayStack-Design-a-Modular-Payments-Gateway -
Install dependencies: Make sure you have Python installed. Then, run:
pip install -r requirements.txt -
Run the application: Start the Flask application by executing:
python src/main.py -
Access the application: Open your browser and navigate to
http://127.0.0.1:5000to access the payment gateway.
- UPI Payment Flow: Implemented in
src/payments/upi.pywith methods to initiate and verify payments. - Card Payment Flow: Implemented in
src/payments/card.pywith similar methods for card transactions.
Webhook events are handled in src/webhooks/handler.py. Ensure your server is accessible to receive webhook notifications from payment providers.
Logging is set up in src/logs/logger.py. Use the Logger class to log information and errors throughout the application.
-
Issue: Application not starting
- Ensure all dependencies are installed correctly. Check for any missing packages in
requirements.txt.
- Ensure all dependencies are installed correctly. Check for any missing packages in
-
Issue: Payment verification fails
- Verify that the payment data is correctly formatted. Use the
validate_payment_datafunction fromsrc/utils/helpers.pyto assist with this.
- Verify that the payment data is correctly formatted. Use the
-
Issue: Webhook not received
- Check your server's accessibility and ensure that the webhook URL is correctly configured with the payment provider.
-
Issue: Logs not being generated
- Ensure that the logging configuration in
src/logs/logger.pyis set up correctly and that the application has permission to write logs.
- Ensure that the logging configuration in
Feel free to submit issues or pull requests to improve the project. Your contributions are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.