Connection and Login
Last updated: 2026-05-19
Connection Lifecycle
The ECR must connect to the terminal and then log in before starting transactions.
- Create the EPAS client.
- Configure library options or parameters.
- Connect to the terminal network endpoint.
- Send login details with terminal ID, workstation ID, operator, language, configuration host, and authorisation host.
- Start transactions.
If the terminal disconnects, it aborts any active transaction and logs out. Reconnect by repeating the connect and login steps.
Network Connection
Use the tabs below to compare the same connection step across .NET, Java, and Swift.
.NET
csharpvar connection = new TerminalNetworkConnection { TerminalConnectionDetails = new IPEndPoint(IPAddress.Parse("192.168.10.25"), 6001), UseKeepAlive = true }; ApiResult result = epas.ConnectNetwork(connection, forceReconnect: false);
Java
javaApiDefinitions definitions = new ApiDefinitions(); ApiDefinitions.TerminalNetworkConnection connection = definitions.new TerminalNetworkConnection(); connection.TerminalConnectionDetails = new IPEndPoint("192.168.10.25", 6001); connection.UseKeepAlive = true; ApiDefinitions.ApiResult result = epas.connectNetwork(connection, false);
Swift
swiftlet connection = TerminalNetworkConnection( terminalConnectionDetails: IPEndPoint("192.168.10.25", 6001), useKeepAlive: true ) try await client.connect(connection)
The Swift implementation throws on connection failure instead of returning an ApiResult. Use do/catch around connect.
Login
The ECR normally logs in once after connecting. Log in again after a disconnect or when changing terminal options such as terminal ID, workstation ID, or host settings.
.NET
csharpvar environment = new TerminalEnvironment { TerminalId = "80000082", StoreId = "store_1", WorkstationId = "pos_1", OperatorId = "cashier_1", ISO639_1_LanguageCode = TerminalEnvironment.LangSwedish, ConfigurationServer = new IPEndPoint(IPAddress.Parse("185.27.171.42"), 55133), AuthorisationServer = new IPEndPoint(IPAddress.Parse("185.27.171.42"), 55144) }; ApiResult result = epas.Login(environment, out LoginResponse response); if (result == ApiResult.OK && response.LoggedIn) { ui.ShowReady(); }
Java
javaApiDefinitions.TerminalEnvironment environment = definitions.new TerminalEnvironment(); environment.TerminalId = "80000082"; environment.StoreId = "store_1"; environment.WorkstationId = "pos_1"; environment.OperatorId = "cashier_1"; environment.SetLanguageCode("sv-SE"); environment.ConfigurationServer = new IPEndPoint("185.27.171.42", 55133); environment.AuthorisationServer = new IPEndPoint("185.27.171.42", 55144); Pair<ApiDefinitions.ApiResult, LoginResponse> result = epas.login(environment); if (result.getKey() == ApiDefinitions.ApiResult.OK && result.getValue().isLoggedIn()) { ui.showReady(); }
Swift
swiftlet environment = TerminalEnvironment( terminalId: "80000082", storeId: "store_1", workstationId: "pos_1", configurationServer: IPEndPoint("185.27.171.42", 55133), authorisationServer: IPEndPoint("185.27.171.42", 55144), operatorId: "cashier_1", iso639_1_LanguageCode: TerminalEnvironment.langSwedish ) let response = try await client.login(environment) if response.loggedIn { ui.showReady() }
Logout and Disconnect
Logout is rarely required during normal operation. Use it when the ECR intentionally changes login context. Disconnect closes the terminal link.
.NET
csharpApiResult logoutResult = epas.Logout(out LogoutResponse logout); ApiResult disconnectResult = epas.Disconnect();
Java
javaPair<ApiDefinitions.ApiResult, LogoutResponse> logoutResult = epas.logout(); ApiDefinitions.ApiResult disconnectResult = epas.disconnect();
Swift
swiftlet logout = try await client.logout() let disconnectResult = await client.disconnect()
Status and Reconnection
Status APIs are useful for UI state and recovery workflows.
.NET
csharpepas.LinkStatus = linkUp => { if (!linkUp) { ui.ShowTerminalDisconnected(); reconnectWorkflow.Schedule(); } };
Java
java@Override public void LinkStatusNotification(boolean linkUp) { if (!linkUp) { ui.showTerminalDisconnected(); reconnectWorkflow.schedule(); } }
Swift
swiftlet status = await client.status() func linkStatusChanged(isConnected: Bool) { if !isConnected { ui.showTerminalDisconnected() reconnectWorkflow.schedule() } }
ClientStatus in Swift exposes isConnected, isLoggedIn, isBusy, isCardInserted, and terminalId.