# Connector and Communication Flows

This page describes how communication between the commercial automation system and the POS terminal is established, maintained, and terminated.

## What is the Connector

The **Connector** is an object returned by `CreateHttp`, `CreateUsb`, or `CreateCloud`. It is the central element that coordinates all message exchange with the POS and enforces the correct execution order of Integrated POS operations.

## The Connector abstraction

A Connector is created by one of the supported factory methods:

* `CreateHttp`
* `CreateUsb`
* `CreateCloud`

Regardless of the underlying transport, the Connector exposes the same set of device operation functions and enforces a consistent communication lifecycle.

## Communication flow overview

Every Integrated POS interaction follows a deterministic flow:

1. **Connector Creation** — The automation system establishes a transport channel and receives a Connector instance.
2. **Terminal Validation** — The `Polling` command is executed to verify terminal availability and readiness.
3. **Operation Execution** — Business operations such as `Sale`, `Refund`, or `GetReports` are invoked.
4. **Response Handling** — The terminal returns a structured response containing the operation result.
5. **Connection Closure** — The automation system releases resources by calling `Close`.

## One operation at a time

The Connector processes one operation at a time. You send a command, then wait for its response before you send the next command.

Do not start a second operation while the terminal still processes the first. This rule keeps the command and response sequence aligned and prevents conflicting state on the terminal.

## Command and response flow

Each command produces a single structured response. The response carries the operation result and a payload that depends on the operation type:

- `ReportDetails` returns the data for reports and shift operations.
- `ReceiptContent` returns the printable content for sale, refund, and voucher operations.
- `AccountingDate` returns the accounting date the terminal applies to the transaction.

You read these fields from the response to confirm the outcome and to drive your next step.

## Transport independence and connection lifecycle

Although communication mechanisms differ between USB, network, and cloud connections, the logical flow remains identical. The same commands are available, the same parameters are expected, and the same response structures are returned. This allows integrators to switch transport models without modifying business logic.

When the Connector is closed, all allocated resources are released, the Connector instance becomes invalid, and further command execution is rejected. A new Connector must be created to resume communication with the POS terminal.

## Related resources

* [Connection Models](/en/integrated-pos/first-steps-pos/connection-models) — USB, network, and cloud creation methods.
* [POS Architecture](/en/integrated-pos/first-steps-pos/pos-architecture) — How the Connector fits into the overall architecture.
* [Quick Start](/en/integrated-pos/first-steps-pos/quickstart-integrated-pos) — Create connector, Polling, Sale, Close.
* For connector creation, Close, and Polling details, see the Core Concepts and Connection Guides.