This is an example web application demonstrating how to integrate Profinity APIs with Square's payment processing system to create a battery-powered charging station. The application monitors battery pack usage through Profinity's APIs and processes payments using Square's APIs for the consumed power.
This example uses the PET Profile in Profinity and sample battery data can be shown by running a replay of the Example PET Log.csv .
The application provides a simple yet complete solution for:
- Real-time monitoring of battery pack status and power consumption
- Secure payment processing through Square
- User-friendly interface for both station operators and customers
Screenshot of the battery charging station web application interface
- Battery Monitoring: Real-time tracking of battery pack status, voltage, current, and power consumption
- Payment Processing: Seamless integration with Square for secure payment processing
- Usage Tracking: Detailed logging of power consumption and associated costs
- User Management: Secure authentication and user management system
Before you begin, ensure you have the following installed:
- Node.js (v14 or later)
- Yarn (recommended) or npm
- A modern web browser
- Profinity API access credentials and a running Profinity instance
- Square API credentials
- Clone the repository:
git clone [repository-url]
cd Charge-for-Power-using-Square-Web- Install dependencies:
yarn installThe application uses environment variables for configuration. You can use either:
.env.productionfor production builds.env.developmentfor development.envfor both environments
Required environment variables:
REACT_APP_PROFINITY_API_URL=your_profinity_api_url
REACT_APP_SQUARE_ACCESS_TOKEN=your_square_access_token
REACT_APP_SQUARE_LOCATION_ID=your_square_location_id
Replace the placeholder values with your actual credentials:
your_profinity_api_url: The URL for your Profinity API instanceyour_square_access_token: Your Square API access tokenyour_square_location_id: Your Square location ID
src/
├── components/ # Reusable UI components
├── services/ # API services (Profinity and Square)
├── hooks/ # Custom React hooks
├── pages/ # Application pages
├── styles/ # Styling and theme configuration
├── types/ # TypeScript type definitions
└── utils/ # Utility functions
The application can be deployed inside Profinity's webserver by copying the files produced during the build see Profinity Hosting https://docs.prohelion.com/Profinity/Profinity_Version2/Extending_Profinity/ in the Profinity documentation for more information.
To start the development server:
yarn startThe application will open in your default web browser at http://localhost:3000
To create a production build:
yarn buildThe build files will be created in the build directory.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE.txt file for details.
For support, please contact Prohelion Support via our website at www.prohelion.com
/public/screen-shot.png)