# Configuration

Controls the title, branding, button label, card scanning, and (optionally) 3D Secure behavior of the payment sheet. Pass an instance to the `configuration` parameter of [PaymentAction](/ios/online/payment-action).

The real type is `PaymentInputController.Configuration`, a nested class on `PaymentInputController`. Reference it with its full name:

```swift
let configuration = PaymentInputController.Configuration(
    title: "Card Entry",
    branding: PaymentInputController.Branding(image: nil, title: "My Company"),
    buttonTitle: "Tokenize"
)
```

The class has two commonly-used initializers: a short one for the normal tokenization flow, and a longer one that also enables 3D Secure. The 3DS initializer takes more arguments because the SDK calls `/3d_secure_sessions` directly from the device.

There are more initializers
Two additional overloads add `postalCodeFormat` and `postalCodeRequired`. The versions shown below cover the common cases; see the SDK's generated interface for the full list.

```swift
PaymentInputController.Configuration(
    title: String?,
    branding: PaymentInputController.Branding,
    buttonTitle: String,
    enableCardScanning: Bool = true
)
```

| Property | Type | Default | Description |
|  --- | --- | --- | --- |
| `title` | `String?` | `"Card Entry"` | Title displayed at the top of the payment sheet navigation bar. |
| `branding` | `PaymentInputController.Branding` | Required (no default) | Logo image and label shown in the form header. See [Branding](#branding). |
| `buttonTitle` | `String` | Required (no default) | Label for the submit button. |
| `enableCardScanning` | `Bool` | `true` | When `true`, offers a camera-based card scanning option on supported devices. Requires `NSCameraUsageDescription` in `Info.plist`. See the [Card Scanner](/ios/online/card-scanner) reference. |


## Branding

Nested on `PaymentInputController`. Both arguments are optional.

```swift
PaymentInputController.Branding(
    image: UIImage? = nil,
    title: String? = nil
)
```

| Property | Type | Default | Description |
|  --- | --- | --- | --- |
| `image` | `UIImage?` | `nil` | Logo image displayed in the form header. |
| `title` | `String?` | `nil` | Label displayed next to the logo image. |


`image` sets the logo image displayed in the form header. `title` sets the label displayed next to it.

```swift
let branding = PaymentInputController.Branding(
    image: UIImage(named: "MyLogo"),
    title: "My Company"
)
```

## ThreeDSConfiguration

Enables 3D Secure (3DS) card authentication after tokenization. When 3DS is configured, the SDK calls `/3d_secure_sessions` to create a session, presents a `WKWebView` challenge if required, and polls the session until it reaches a terminal state. The authentication outcome is returned alongside the token on a [`PaymentSheetResponse`](/ios/online/token-response#paymentsheetresponse), not on the token itself.

3DS requires API credentials in the client
The 3DS-enabled `Configuration` initializer takes `merchantId`, `apiUsername`, `apiPassword`, `amount`, and `currency` because the SDK calls Finix's 3DS endpoint directly from the device. This differs from the non-3DS flow, where only the Application ID lives in the app. Treat the embedded credentials as Sandbox-only, scope them tightly, and prefer rotating keys for mobile use.

```swift
ThreeDSConfiguration(
    redirectScheme: String,
    isEnabled: Bool = true
)
```

| Property | Type | Default | Description |
|  --- | --- | --- | --- |
| `redirectScheme` | `String` | Required | Custom URL scheme the issuer's challenge page returns to when authentication completes. Must match a `CFBundleURLSchemes` entry in your app's `Info.plist`. See [Register the redirect URL scheme](/ios/online/integration#register-the-redirect-url-scheme). |
| `isEnabled` | `Bool` | `true` | Set to `false` to construct a `ThreeDSConfiguration` without triggering 3DS. Useful for runtime toggles. |


Use the longer `Configuration` initializer. All of `merchantId`, `apiUsername`, `apiPassword`, `amount`, and `currency` are required when 3DS is enabled:

```swift
let threeDSConfig = ThreeDSConfiguration(redirectScheme: "yourappscheme")

let configuration = PaymentInputController.Configuration(
    title: "Card Entry",
    branding: PaymentInputController.Branding(image: nil, title: "My Company"),
    buttonTitle: "Pay Now",
    enableCardScanning: true,
    threeDSConfiguration: threeDSConfig,
    merchantId: "MUxxxxxxxxxxxxx",
    apiUsername: "USxxxxxxxxxxxxx",
    apiPassword: "{api_password}",
    amount: 100,          // cents
    currency: "USD"
)
```

Register the same scheme in your `Info.plist` under `CFBundleURLTypes` or the SDK will time out waiting for the redirect. See [Register the redirect URL scheme](/ios/online/integration#register-the-redirect-url-scheme).

## Sheet title & button

Override the default sheet title and submit button label with your own strings. Common overrides: `"Pay Now"`, `"Confirm"`, `"Submit"`.

## Full example

Pass a `PaymentInputController.Configuration` instance to `PaymentAction` via the `configuration` parameter. The example below enables card scanning and 3D Secure.