# Installation & Initialization

Add the SDK to your Xcode project via Swift Package Manager. In Xcode, go to **File → Add Package Dependencies** and enter the repository URL:


```
https://github.com/finix-payments/finix-pax-mpos-ios-sdk
```

Physical device required
The SDK requires a physical iOS device. The simulator is not supported.

Add the following key to your app's `Info.plist`. Without it, the OS will not grant access to Bluetooth and scanning will fail.


```xml
<key>NSBluetoothAlwaysUsageDescription</key>
<string>This app uses Bluetooth to communicate with your payment device.</string>
```

## Initialization

Create a `FinixClient` instance with your [credentials](/ios/card-present/credentials). Set `deviceId` to an empty string on first initialization — you will update it after device discovery.

## Scan for Devices

Call `startScan()` to begin scanning for nearby PAX D135 devices over Bluetooth. Each discovered device is reported via `FinixDelegate`.

| Delegate Method | Trigger |
|  --- | --- |
| `didDiscoverDevice(_ deviceInfo: DeviceInfo)` | Called each time a nearby device is found. `deviceInfo.id` is the Bluetooth identifier. |


Bluetooth permission prompt
When running for the first time, the OS will show a Bluetooth permission dialog. If the user dismisses the device list before granting access, have them dismiss and re-open the scanner after tapping Allow.

## Register the Device

If you haven't already created and activated the device in Finix, do so now before connecting. Use the serial number printed on the PAX D135 (or the one surfaced in `didDiscoverDevice`).

1. **Create** — POST to `/merchants/{merchant_id}/devices` with `"model": "PAX_D135"` and `"serial_number"`. Copy the `id` from the response — this is your `deviceId`.
2. **Activate** — PUT to `/devices/{device_id}` with `"action": "ACTIVATE"`.


See [Device Setup](/ios/card-present/device-setup) for the full API calls and Dashboard alternative.

## Connect to a Device

Call `connectDevice(_:)` with the `DeviceInfo.id` from the scan callback. The PAX D135 indicates status with its LED:

- **Orange light** — ready for pairing
- **Green light** — fully charged
- **Green light only (after connect)** — connected and ready


| Delegate Method | Trigger |
|  --- | --- |
| `deviceDidConnect(_ deviceInfo: DeviceInfo)` | Called when the device is connected and ready to accept transactions. |


After `deviceDidConnect`, call `finixClient.update(deviceId:)` with the connected device's ID before starting a transaction.