This project is an E-payment application that allows users to make payments online. The project integrates with the Flutterwave payment gateway for processing transactions. Below is a step-by-step guide on how to set up and run the project.
- Installation
- Usage
- Configuration
- Payment Integration
- Database Structure
- Testing
- Contributing
- License
-
Clone the repository:
git clone https://github.com/KabriAcid/e-payment.git cd e-payment
-
Set up your local server (e.g., XAMPP, WAMP, MAMP) and place the project in the appropriate directory (e.g.,
htdocs
for XAMPP). -
Ensure you have PHP and MySQL installed on your machine.
-
Start your local server.
-
Access the project in your web browser:
http://localhost/e-payment/public/
-
Flutterwave API Keys: Obtain your Flutterwave API keys from the Flutterwave Dashboard.
-
Config File: Update the
config.php
file with your database credentials and API keys.
The payment integration is handled using Flutterwave. Below are the key steps involved:
-
Create a Simple Payment Form:
- An HTML form collects the payment details from the user.
- A JavaScript function initializes the Flutterwave payment popup.
-
Verify Payment:
- After the payment, Flutterwave redirects the user to
redirect.php
. redirect.php
extracts the transaction ID and uses CURL to verify the payment with Flutterwave's API.- If the payment is successful, it updates the database and displays a success message.
- After the payment, Flutterwave redirects the user to
-
Redirect to Dashboard:
- The success message is displayed briefly before redirecting the user to
dashboard.php
.
- The success message is displayed briefly before redirecting the user to
Create the database and table to store the transaction details:
CREATE DATABASE e-payment;
USE e-payment;
CREATE TABLE transactions (
id INT AUTO_INCREMENT PRIMARY KEY,
transaction_id VARCHAR(255) NOT NULL,
amount DECIMAL(10, 2) NOT NULL,
currency VARCHAR(10) NOT NULL,
customer_email VARCHAR(255) NOT NULL,
status VARCHAR(50) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);