Git Product home page Git Product logo

jumla-online / flask-web---mpesa-integration-test Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 598 KB

This repository contains a Flask web application integrated with the M-Pesa API for seamless mobile payments. The application allows users to make payments using M-Pesa's STK Push functionality. It provides endpoints for generating M-Pesa access tokens, initiating STK Push requests, and handling callback responses from M-Pesa.

Python 29.80% JavaScript 6.71% CSS 8.90% HTML 54.58%

flask-web---mpesa-integration-test's Introduction

Flask M-Pesa Integration This project demonstrates how to integrate M-Pesa functionality into a Flask web application. The application allows users to initiate M-Pesa STK Push transactions using a simple web interface.

Features STK Push Integration: Enables users to initiate M-Pesa transactions directly from the web application. Callback Handling: Handles M-Pesa callback responses to track transaction statuses. Template Rendering: Utilizes Flask's template rendering to provide dynamic HTML content. Responsive Design: Provides a user-friendly interface using HTML, JavaScript, and CSS. Requirements Python 3.x Flask Requests library for Python M-Pesa Developer Account (Sandbox environment for testing) Setup Clone the repository:

bash Copy code git clone https://github.com/jumla-online/flask-mpesa-integration.git Install dependencies:

bash Copy code pip install -r requirements.txt Configure M-Pesa Credentials:

Obtain M-Pesa API credentials (consumer key, consumer secret, etc.) from the Safaricom Developer Portal. Update the access_token.py and lipana_mpesa_password.py files with your credentials. Run the Flask application:

bash Copy code python app.py Access the application in your web browser at http://localhost:5000.

Usage Access the web interface. Enter your name and phone number. Click on the "Initiate Payment" button. Follow the prompts on your phone to complete the M-Pesa transaction. View transaction status updates in the application. Folder Structure templates/: Contains HTML templates for rendering dynamic content. static/: Stores static assets such as CSS stylesheets and JavaScript files. app.py: Main Flask application file containing route definitions and logic. access_token.py: Stores M-Pesa access token retrieval logic. lipana_mpesa_password.py: Stores M-Pesa password generation logic. README.md: This README file providing information about the project. Contributing Contributions are welcome! Please feel free to submit issues and pull requests.

License This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments Special thanks to Safaricom for providing the M-Pesa API. Thanks to the Flask community for the web framework.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.