This repository contains a MERN (MongoDB, Express.js, React, Node.js) application that integrates Square's payment processing capabilities. It includes a frontend React component for handling payments and a backend server for processing transactions with Square. To use it in your Project, just move the components into your app and install the dependencies.
- Full-stack MERN application with a focus on payment processing.
- Integration with Square's secure payment system.
- Reusable React component for Square payment forms.
- Backend service for handling payment transactions.
- Node.js and npm installed.
- MongoDB setup (locally or remotely).
- Square account with Application and Location IDs for payment processing.
-
Clone the repository:
git clone [your-repo-link]
-
Navigate to the project directory:
cd [your-project-directory]
-
Navigate to the backend directory:
cd backend
-
Install backend dependencies:
npm install dotenv mongoose cors express square uuid
-
Create a
.env
file in the backend directory and set your Square access token:SQUARE_ACCESS_TOKEN=[Your Square Access Token]
-
Start the backend server:
npm start
-
Navigate to the frontend directory:
cd frontend
-
Install frontend dependencies:
npm install react-square-web-payments-sdk
-
Create a
.env
file in the frontend directory and set your Square Application and Location IDs:REACT_APP_SQUARE_APPLICATION_ID_SANDBOX=[Your Application ID] REACT_APP_SQUARE_LOCATION_ID_SANDBOX=[Your Location ID]
-
Start the frontend application:
npm start
Once both the frontend and backend are set up and running, navigate to the frontend URL (typically http://localhost:3000
) to interact with the payment form.
Contributions to the project are welcome. Feel free to fork the repository, make changes, and submit pull requests.
MIT