# Enroll a managed fleet

Enroll every store phone from your MDM by pushing its enrollment code through the Kustom POS app's managed configuration, so nobody types a code in store.

If your store phones are managed with a Mobile Device Management (MDM) platform, you can
deploy the Kustom POS app and enroll every phone from the MDM console. Nobody types a code
in the store: you push each phone's code through the app's managed configuration, and the
app registers itself when it starts.

## Before you start

- You can [create enrollments](/in-person/enroll-a-device/#1-create-an-enrollment) — this
  page changes how a code reaches the phone, not how it's made.
- Your MDM can deploy the Kustom POS app (`co.kustom.kustom`) on Android Enterprise, iOS or
  both.

## Step by step

### 1. Create one enrollment per device

Codes are single-use, so 100 phones need 100 codes, and a code pushed to two phones enrolls
only the first.

- **Pick a `ttl` that covers the gap** between creating the codes and each phone first
  opening the app. `THIRTY_DAYS` is the longest.
- **Tag each enrollment with metadata that identifies its phone.** It carries over to the
  device record, which is how you find that device afterwards.

### 2. Set the code in the app's managed configuration

Add the Kustom POS app to your MDM and set one value per device:

| Platform | Where to set it | Key | Value |
|---|---|---|---|
| Android (Android Enterprise) | The app's managed configuration page, where the field is labeled **Kustom mPOS Enrollment Code** | `enrollmentCode` | The device's enrollment code |
| iOS | The app's Managed App Configuration, as a key/value entry. There's no pre-built form, so type the key exactly | `enrollmentCode` | The device's enrollment code |

### 3. Let the app pick it up

The app looks for a code when it starts and whenever it returns to the foreground. If it's
already open when the configuration arrives, Android picks the code up right away. iOS
picks it up right away only while the app is in the foreground, and otherwise the next time
it's opened.

A phone that's already enrolled ignores changes to its configured code. To move one to
another location or account, [deregister it](/api/in-person-payments/deregister-device/),
then push a new code.

Once it works, each phone opens past the enrollment screen and appears in
[`GET /ipp/v1/devices`](/api/in-person-payments/list-devices/) carrying the metadata you
tagged its enrollment with.

## Troubleshooting

What the phone shows tells you what went wrong:

- **No code configured.** The app shows the manual enrollment screen. Check the
  configuration is assigned to that device and your MDM has finished syncing.
- **Code rejected** (invalid, expired or already used). The app shows an error and offers
  manual entry. You don't need to touch the phone: push a new, unused code and the app
  tries it automatically.
- **No network connection.** The app shows the manual enrollment screen, and tries the
  pushed code again the next time it's opened or brought to the foreground.

## Related

- [Take a payment](/in-person/take-a-payment/) — send a cart to an enrolled device
