# Connecting via the Cloud (CreateCloud)

This guide explains how to connect an Integrated POS terminal remotely, through the Getnet cloud, using `CreateCloud`.

---

## When to use the Cloud2Cloud connection

Use a Cloud2Cloud connection when:

* The terminal is remote and not reachable on your local network
* Your automation system runs as a backend or cloud service
* You manage distributed terminals across different locations

The Getnet cloud relays each command to the registered terminal, so no hostname or port is required.

---

## Before you begin

Before connecting through the cloud, ensure that:

* The POS terminal is powered on and configured for Integrated POS mode
* The Connector App is installed and active on the terminal
* The terminal is registered for cloud communication and the required cloud services are available
* You have integrated the Integrated POS library for Android (AAR) or JavaScript

---

## Step 1: Create the Cloud Connector

Establish the cloud channel with `CreateCloud`. No host or port is required; the cloud transport routes each command to the registered terminal.

```javascript
import { Connector } from 'pos-integrated-lib-javascript';

// Initialize the cloud connector
const connector = Connector.CreateCloud();
```

At this point, the cloud channel is initialized but the terminal has not yet been validated.

<Callout type="note">

`CreateCloud` accepts an optional `setupParams` map to apply terminal configuration. Check the reconnection flow before using it.

</Callout>

---

## Step 2: Validate the terminal

Validate the terminal using the `Polling` command before executing any operation:

```javascript
const pollingResult = await connector.PollingAsync();
```

A successful response (`Code = 0`, `Connected = true`) indicates that the POS is connected and ready. Proceed only if the Polling response indicates readiness.

---

## Step 3: Execute operations

Once validated, use the Connector to run operations such as:

* `Sale`
* `Refund`
* `GetReports`

Operations are processed sequentially — one at a time per Connector.

---

## Step 4: Close the connection

After finishing all operations, close the Connector:

```javascript
await connector.Close();
```

Closing releases the cloud session cleanly. The Connector instance cannot be reused after closure.

---

## Cloud connection considerations

* Cloud connections depend on an external service, so plan for latency
* Network or service interruptions may require reconnection and a new `Polling`
* If you use a custom `friendly_name`, send it on every connection, because reconnection resets the terminal configuration
* `CreateCloud` is available in the Kotlin and JavaScript/TypeScript libraries

---

## Next steps

* [Connection Models](/en/integrated-pos/first-steps-pos/connection-models) — Comparison of the SDK (USB / HTTP) and Cloud2Cloud modes.
* [Connector and Communication Flows](/en/integrated-pos/core-concepts-pos/connector-communication-flows) — Lifecycle and sequential execution rule.
* [Reconnection, Polling, and Resilience](/en/integrated-pos/core-concepts-pos/polling-reconnection) — When to poll and how reconnection works.
* [Methods and Parameters Reference](/en/integrated-pos/reference/methods-parameters) — CreateCloud parameters and code examples.