# Introduction
URL: /docs/lan

Drive a POS+ device from your POS software over the local network with line-delimited JSON over TCP.

The **LAN** integration lets software that runs on another machine — a Windows
till, a kitchen display, a kiosk backend — send App2App requests to a POS+
device on the same local network. The device performs the payment and answers
on the same connection.

It is the same request model as [App2App](/docs/a2a): a JSON object with a
`header` and a `data` part, the same operations and the same `PP_A2A_*` error
codes. Only the transport differs: instead of an Android intent, the message
travels as **one line of JSON over TCP**.

## How it works

```
┌──────────────────┐  1. {"header":…,"data":…}\n   ┌──────────────┐
│                  │ ────────────────────────────▶ │              │
│  Your POS        │         TCP :8471             │  POS+ device │
│  software        │                               │              │
│                  │ ◀──────────────────────────── │  2. cashier  │
└──────────────────┘  3. one line of JSON\n        │     + card   │
                                                   └──────────────┘
```

1. Your software opens a TCP connection to the device (port `8471` by default)
   and writes a request as a single line ending with `\n`.
2. POS+ comes to the foreground and runs the operation: the customer taps the
   card, the cashier confirms cash, and so on.
3. When the receipt screen closes, the device writes the result as a single
   line on the same connection.

<Callout type="warn">
  Payment calls are **long-running**. The reply arrives only after the cashier
  finishes, which can take minutes. Use a read timeout of at least 900 seconds
  and never treat a slow reply as a failure.
</Callout>

## When to use LAN

| Situation                                                 | Use                            |
| --------------------------------------------------------- | ------------------------------ |
| Your app runs on the POS+ device itself                   | [App2App](/docs/a2a)           |
| Your server sends orders over the internet                | [Public API](/docs/public-api) |
| Your software runs on another machine on the same network | **LAN**                        |

LAN needs the internet only to validate your keys. The payment request itself
does not leave the local network until POS+ talks to the bank.

## Requirements

* A POS+ device on Android (SoftPOS is not supported) with **Local
  communication** turned on. See [Connection](/docs/lan/connection#enable-on-the-device).
* POS+ logged in on the device at least once.
* Your `api_key` and `secret_key` from the **Credentials** page of the
  developer portal. They are sent in every request header.
* Network access from your machine to the device on TCP `8471` (and UDP `8470`
  if you use discovery).

## Next steps

* [Connection](/docs/lan/connection) — enabling the device, discovery, framing and authentication
* [Commands](/docs/lan/commands) — every `transaction_type` with request and response
* [Errors](/docs/lan/errors) — error codes, recovery and concurrency
* [Reference](/docs/lan/reference) — models and enums