- 📄 Description
- 💡 What is Pix?
- ✨ Features
- 🛠 Technologies Used
- 📋 Prerequisites
- ⚙️ Setup
- 🔌 API Endpoints
- 📧 Email Verification
- 🔐 Security
- 📜 License
- 🤝 Contributing
- 🙏 Acknowledgments
This project is an E-Commerce Payment System that integrates the Pix payment method. It allows users to create and manage Pix transactions efficiently. The system is built using Java and Spring Boot, leveraging the EfiPay SDK for handling Pix operations.
Pix is a real-time payment system developed by the Central Bank of Brazil. It allows users to make instant payments 24/7, using various methods such as QR codes, phone numbers, and email addresses. Pix is designed to be fast, secure, and cost-effective, making it a popular choice for both consumers and businesses in Brazil.
- 🔐 User authentication and authorization using JWT (JSON Web Token)
- 🔒 Password encryption for secure storage
- 📧 Email verification after user registration
- 💵 Create Pix charges
- 📱 Generate QR codes for payments
- 🧪 Support for sandbox and production environments
- 🛠️ Debug mode for development
- ☕ Java: Programming language for backend development.
- 🌱 Spring Boot: Framework for building the backend RESTful API.
- 🧰 EfiPay SDK: Library for interacting with the Pix payment system.
- 🔑 JWT: Token-based authentication.
- 🔐 BCrypt: Password hashing for secure storage.
- 📧 SMTP: For sending email verifications.
- 📊 JSON: Data format for API requests and responses.
- 🔧 JDK 11 or higher
- 🐘 Maven
- 📝 An active EfiPay account with client credentials
-
📥 Clone the repository:
git clone https://github.com/luiz-matoso/e-commerce-payment-system.git
-
📂 Navigate to the project directory:
cd e-commerce-payment-system -
📝 Add your credentials: Create a
credentials.jsonfile in thesrc/main/resourcesdirectory with the following structure:{ "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", "certificate": "./certs/your_certificate.p12", "sandbox": true, "debug": false } -
🔨 Build the project:
Use Maven to build the project:
mvn clean install
-
▶️ Run the application:mvn spring-boot:run
-
🌐 Access the API: Open your browser or a tool like Postman and navigate to:
http://localhost:8080/api/auth/login
Use the following JSON body to log in:
{ "email": "your_email@example.com", "password": "your_password" }
- POST
/api/auth/login: Authenticates the user and returns a JWT token. - POST
/api/auth/register: Registers a new user with encrypted password and sends an email verification link.
- POST
/api/pix: Creates a Pix charge with the specified parameters.
- After a user registers through
/api/auth/register, an email is sent with a verification link. - The user must click the link in the email to confirm their account and complete the registration process.
- GET
/api/auth/verify?code=your_verification_token: This endpoint verifies the user's email using the token received in the email.
- JWT (JSON Web Token) is used for secure user authentication, ensuring that only authenticated users can access certain endpoints.
- BCrypt password hashing is used to securely store user passwords, adding a layer of protection against unauthorized access.
- Email verification ensures that only valid email addresses can be used for user registration, enhancing security and preventing spam accounts.
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributions are welcome! Please create a pull request or open an issue to discuss improvements.
- Thanks to the EfiPay team for providing the Pix SDK.