A Java console-based Payment Gateway System developed to demonstrate the practical implementation of core Object-Oriented Programming (OOP) concepts.
The application simulates a simple payment processing workflow where users can select a payment method, enter a payment amount, process the transaction, and receive a formatted payment receipt containing transaction details and the current date and time.
The Payment Gateway System is a simple Java-based console application created to demonstrate how Object-Oriented Programming concepts can be applied to a real-world scenario.
The system allows users to:
- Select a payment method
- Enter the payment amount
- Process the payment
- Generate a formatted payment receipt
- View the transaction date and time
The project currently supports UPI and Credit Card payments and is designed in a way that makes it easy to add new payment methods in the future.
โ ๏ธ Note: This is an educational simulation and does not process real financial transactions.
-
๐ฐ Accepts payment amount from the user
-
๐ณ Supports multiple payment methods
- UPI Payment
- Credit Card Payment
-
โ๏ธ Processes the selected payment method
-
๐งพ Automatically generates a formatted payment receipt
-
๐ Displays the current date and time
-
๐ Easy to extend with additional payment methods
-
๐ฅ๏ธ Simple console-based user interface
-
๐งฉ Demonstrates real-world usage of Java OOP concepts
This project demonstrates several important Object-Oriented Programming concepts.
A Payment interface defines a common structure for all payment methods.
interface Payment {
void processPayment(double amount);
}Different payment classes implement this interface according to their requirements.
The payment-processing functionality is abstracted through the Payment interface.
The user does not need to know the internal implementation of each payment method. They simply select a payment method and provide the amount.
Polymorphism allows different payment implementations to be handled using the same interface reference.
Payment payment;
payment = new UPI();
payment.processPayment(amount);
payment = new CreditCard();
payment.processPayment(amount);The same Payment reference can represent different payment implementations.
Each payment class provides its own implementation of the processPayment() method.
class UPI implements Payment {
@Override
public void processPayment(double amount) {
System.out.println("Processing UPI payment...");
}
}The CreditCard class can similarly override the method to provide its own implementation.
| Technology | Purpose |
|---|---|
| โ Java | Main programming language |
| ๐งฉ Object-Oriented Programming | Application design |
๐ฆ java.util |
Utility classes |
โจ๏ธ Scanner |
User input |
๐
Date |
Current date and time |
Payment-Gateway-System/
โ
โโโ src/
โ โโโ Payment.java
โ โโโ UPI.java
โ โโโ CreditCard.java
โ โโโ Main.java
โ
โโโ README.md
โโโ .gitignore
| File | Description |
|---|---|
Payment.java |
Defines the common payment interface |
UPI.java |
Implements UPI payment functionality |
CreditCard.java |
Implements Credit Card payment functionality |
Main.java |
Handles user input and program execution |
README.md |
Project documentation |
โโโโโโโโโโโโโโโโโโโ
โ START โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Select Payment โ
โ Method โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โโโโโโโโโโดโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ UPI โ โ Credit Card โ
โโโโโโโฌโโโโโโ โโโโโโโโฌโโโโโโโโ
โ โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Enter Payment โ
โ Amount โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Process Payment โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ Generate Receipt โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ END โ
โโโโโโโโโโโโโโโโโโโ
Make sure Java JDK is installed on your computer.
Check your Java installation:
java -versionCheck the Java compiler:
javac -versiongit clone https://github.com/your-username/payment-gateway-system.gitcd payment-gateway-systemIf all .java files are in the same directory:
javac *.javajava Main========================================
PAYMENT GATEWAY SYSTEM
========================================
1. UPI Payment
2. Credit Card Payment
Enter your choice: 1
Enter payment amount: 2500
----------------------------------------
PAYMENT RECEIPT
----------------------------------------
Payment Method : UPI
Amount : โน2500.00
Status : Payment Successful
Date & Time : Sun Aug 09 22:15:30 IST 2026
----------------------------------------
Thank you for using our Payment Gateway!
The project can be further enhanced by adding:
- ๐ฆ Net Banking
- ๐ณ Debit Card Payment
- ๐ฑ Digital Wallets
- ๐ OTP Verification
- ๐ PIN Verification
- ๐ Unique Transaction ID
- ๐ Transaction History
- ๐พ Database Integration
- ๐งพ Receipt File Generation
โ ๏ธ Input Validation- ๐ก๏ธ Exception Handling
- ๐ Web-Based Interface
- ๐ฅ๏ธ JavaFX/Swing GUI
The main objective of this project is to understand and implement:
- Classes and Objects
- Interfaces
- Abstraction
- Polymorphism
- Method Overriding
- Encapsulation
- User Input using
Scanner - Date and Time Handling
- Basic Java Application Structure
- Extensible Object-Oriented Design
โโโโโโโโโโโโโโโโโโโโโโ
โ Payment โ
โ Interface โ
โโโโโโโโโโโฌโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ UPI โ โ CreditCard โ
โ Payment โ โ Payment โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
The Payment interface provides a common contract for all payment methods.
Each payment implementation overrides the payment-processing method according to its own behavior.
This application is created strictly for educational purposes.
It does not connect to:
- Banks
- UPI networks
- Credit card networks
- Payment gateways
- Real financial services
No real money or financial transactions are processed by this application.
Through this project, I learned how to apply Java OOP concepts to a practical problem.
The project helped me understand how interfaces and polymorphism can make an application easier to maintain and extend. It also provided practical experience with user input, method overriding, and generating formatted transaction information.
Sanchi Agarwal
Java | Object-Oriented Programming | Software Development
If you found this project useful or interesting, consider giving the repository a โญ on GitHub!
This project is created for educational and learning purposes.