# Transactions

Call `startTransaction()` after a successful device connection to initiate a card-present payment. The amount must be expressed in cents using the `Currency` type.


```swift
finixClient.startTransaction(
    amount: Currency,
    type: TransactionType,
    splitTransfers: [SplitTransfer]? = nil,
    tags: ResourceTags? = nil,
    buyerIdentityId: String? = nil,
    surchargeAmount: Int? = nil,
    tipAmount: Int? = nil,
    signaturePending: Bool? = nil
) { (transferResponse: TransferResponse?, error: Error?) in
    // handle result
}
```

| Parameter | Type | Required | Description |
|  --- | --- | --- | --- |
| `amount` | `Currency` | Yes | Transaction amount. Use `Currency(amount: Int, code: .USD)` where `amount` is in cents (e.g., `1000` for $10.00). |
| `type` | `TransactionType` | Yes | Type of transaction. Supported values: `.SALE`, `.AUTHORIZATION`, `.REFUND`. |
| `splitTransfers` | `[SplitTransfer]?` | No | Split the transaction across multiple merchants. Requires `ROLE_PARTNER` credentials. |
| `tags` | `ResourceTags?` | No | Custom key-value metadata attached to the transaction. |
| `buyerIdentityId` | `String?` | No | Finix Identity ID of the buyer. |
| `surchargeAmount` | `Int?` | No | Optional surcharge amount in cents. The SDK passes this value through as-is — surcharge logic must be handled by your application. |
| `tipAmount` | `Int?` | No | Optional tip amount in cents. The SDK passes this value through as-is — tip logic must be handled by your application. |
| `signaturePending` | `Bool?` | No | Set to `true` if a signature will be captured and submitted via `/signature_uploads` for this transfer. |


## Currency

Construct a `Currency` value with the amount in cents and the ISO currency code.


```swift
Currency(amount: Int, code: CurrencyCode)
```

| Parameter | Description |
|  --- | --- |
| `amount` | Integer amount in the smallest currency unit (cents for USD). For example, `1000` represents $10.00. |
| `code` | ISO currency code. Use `.USD` for US dollars. |


## Completion Handler

The completion closure receives a `TransferResponse` on success or an `Error` on failure. Always dispatch UI updates back to the main actor.

| Parameter | Trigger |
|  --- | --- |
| `transferResponse` | Transaction approved. Contains the transfer and authorization details. |
| `error` | Transaction declined or failed. Check `error.localizedDescription` for details. |