Mpesa Daraja APIS Intergration
This project is a web application that facilitates online payments using the Safaricom Daraja API. It allows users to initiate payments by providing an amount and a phone number.
To install and run this project locally, follow these steps:
- Clone the repository:
git clone https://github.com/your-username/your-project.git
- Navigate to the project directory:
frontend:
cd Frontend
backend:cd Backend
- Install dependencies:
npm install
- Start the backend server:
npm start
- Start the frontend application:
npm run dev
Once the project is set up, open a web browser and go to http://localhost:5173
to access the application. Enter the desired amount and phone number, then click the "Initiate Payment" button to start the payment process.
The backend of this project is built with Node.js and Express. It handles payment initiation through the Safaricom Daraja API.
- Express
- Axios
- dotenv
- cors
Create a .env
file in the root directory and add the following variables:
The frontend of this project is built with React. It provides the user interface for initiating payments.
- React
- Axios
- Method: POST
- Description: Initiates a payment process
- Request Body: JSON object containing amount and phoneNumber
- Response: Success or error message
Contributions to this project are welcome. If you have suggestions for improvements or find any issues, please open an issue or submit a pull request.