IntegrationHub-DelphiTemplate
- Active · last change 6-30-2025
- ★ 1 on GitHub
README
TokenX Connect (Wired) / Integration Hub - Delphi Implementation
A comprehensive Delphi implementation for integrating Point of Sale (POS) systems with payment terminals through the TokenX Connect (Wired) integration, also known as Integration Hub.
Overview
This project provides a clean and robust Delphi wrapper for the TokenX Connect (Integration Hub) library, allowing seamless communication between POS applications and payment terminals. The integration handles the complexities of device communication, allowing developers to focus on the business logic instead of low-level protocol implementations.
Features
- Dynamic DLL Loading: Automatically loads required DLLs at runtime
- Event-driven Architecture: Uses callback-based device state monitoring
- Asynchronous Communication: Non-blocking operations with proper thread synchronization
- Comprehensive Error Handling: Robust error reporting and recovery mechanisms
- Auto-reconnection: Automatically attempts to reestablish connection on failure
- Thread-safe UI Updates: All UI operations are properly marshaled to the main thread
Key Functionality
- Basket/Cart Processing: Send item lists and amounts to payment terminals
- Payment Processing: Process various payment types (credit, debit, cash, etc.)
- Fiscal Information: Retrieve fiscal data from connected devices
- Detailed Logging: Comprehensive logging for debugging and audit purposes
Technical Implementation
- Language: Object Pascal (Delphi)
- UI Framework: Visual Component Library (VCL)
- Design Pattern: Singleton for POS communication manager
- External Dependencies:
- IntegrationHubCpp.dll - Main integration library
- libcrypto-3.dll - Cryptography support library
- libusb-1.0.dll - USB communication library
- zlib1.dll - Compression library
Project Structure
- Unit1.pas: Main implementation file containing both UI and business logic
- Unit1.dfm: Form definition file for the user interface
- TPOSCommunication Class: Handles all communication with payment terminals
- TForm1 Class: Provides user interface and event handling
Requirements
- Windows operating system
- Delphi IDE (developed and tested with Delphi 10.x+)
- TokenX Connect (Wired) / Integration Hub installation
- Connected payment terminal (for actual usage)
Setup Instructions
- Clone this repository
- Ensure all required DLLs are available in the application directory or Win32\Debug subdirectory:
- IntegrationHubCpp.dll
- libcrypto-3.dll
- libusb-1.0.dll
- zlib1.dll
- Open the project in Delphi IDE
- Build and run the application
Usage Example
The demo application provides a simple interface for testing the integration:
- Connection: The application automatically attempts to connect to available payment terminals
- Send Basket: Sends a sample basket of items to the payment terminal
- Send Payment: Initiates a payment transaction on the terminal
- Get Fiscal Info: Retrieves fiscal information from the connected device
Customization
To integrate with your own POS system:
- Modify the company name in the
FormCreatemethod:FPOSComm := TPOSCommunication.Create(Self, 'YourCompanyName'); - Customize the basket and payment JSON structures to match your business requirements
- Implement additional error handling and recovery as needed for your environment
Troubleshooting
- DLL Loading Issues: Ensure all required DLLs are available in the application directory or Win32\Debug
- Connection Problems: Check physical connection to the terminal and verify device drivers
- Transaction Errors: Check the log output for specific error codes and messages

