# Credentials

`FinixConfig` holds the credentials and device configuration used to initialize the SDK. Pass it to the `FinixClient` constructor.


```swift
FinixConfig(
    environment: Finix.Environment,
    credentials: Finix.APICredentials,
    merchantId: String,
    mid: String,
    deviceType: DeviceType,
    deviceId: String,
    serialNumber: String? = nil
)
```

| Field | Type | Description |
|  --- | --- | --- |
| `environment` | `Finix.Environment` | `.Sandbox` for testing, `.Production` for live payments. |
| `credentials` | `Finix.APICredentials` | Your Finix API username and password. See [APICredentials](#api-credentials). |
| `merchantId` | `String` | Your Finix Merchant ID (`MU...`). |
| `mid` | `String` | Merchant identifier number. Pass an empty string if not required. |
| `deviceType` | `DeviceType` | Set to `.Pax` for the PAX D135. |
| `deviceId` | `String` | The Finix Device ID (`DV...`) created during [device setup](/ios/card-present/device-setup). Pass an empty string on first initialization; update via `finixClient.update(deviceId:)` after device discovery. |
| `serialNumber` | `String?` | Optional. The physical serial number printed on the PAX D135 device. |


## APICredentials


```swift
Finix.APICredentials(
    username: String,
    password: String
)
```

| Field | Type | Description |
|  --- | --- | --- |
| `username` | `String` | Your Finix API key. |
| `password` | `String` | Your Finix API secret. |


The API credentials you use must have the appropriate role:

- `ROLE_MERCHANT` - for single-merchant devices. Recommended for dedicated point-of-sale hardware.
- `ROLE_PARTNER` - required for multi-merchant devices and split transactions.


## Creating API Credentials

Use `ROLE_MERCHANT` credentials to scope a device to a single merchant. Use `ROLE_PARTNER` credentials if the device will process payments across multiple merchants. Note that split transactions require `ROLE_PARTNER` credentials.

Once created, you can use `ROLE_MERCHANT` credentials across multiple devices as long as the devices are associated to the same Merchant.

Example
User - ROLE_MERCHANT

```json User - ROLE_MERCHANT
{
  "id": "USoR21bF52KLZpbQCptrexpH",
  "created_at": "2025-12-08T18:35:51.41Z",
  "updated_at": "2025-12-08T18:35:51.41Z",
  "created_by": "USfdccsr1Z5iVbXDyYt7hjZZ",
  "email": null,
  "enabled": true,
  "first_name": null,
  "identity": "IDjvxGeXBLKH1V9YnWm1CS4n",
  "last_name": null,
  "last_used_date": null,
  "password": "f2fd7118-66c3-495c-8942-8178e0ea9d0c",
  "role": "ROLE_MERCHANT", // [!code highlight]
  "tags": {},
  "_links": {
    "self": {
      "href": "https://finix.sandbox-payments-api.com/users/USoR21bF52KLZpbQCptrexpH"
    },
    "applications": {
      "href": "https://finix.sandbox-payments-api.com/applications"
    },
    "application": {
      "href": "https://finix.sandbox-payments-api.com/applications/APc9vhYcPsRuTSpKD9KpMtPe"
    }
  }
}
```

API Definition
1. Log in to the Finix dashboard.
2. Select the environment for which you would like to create API credentials (Sandbox or Live).
3. In the bottom left corner, select the **Developer** section.
4. In the API Keys section, select **Create API Key**.


Create API Key
## Sandbox and Production

Set `environment` to match the environment your device is designated for. Devices cannot switch environments after designation.

| Value | Environment |
|  --- | --- |
| `.Sandbox` | Sandbox |
| `.Production` | Production |