Skip to content

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.

Function signature

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
}
ParameterTypeRequiredDescription
amountCurrencyYesTransaction amount. Use Currency(amount: Int, code: .USD) where amount is in cents (e.g., 1000 for $10.00).
typeTransactionTypeYesType of transaction. Supported values: .SALE, .AUTHORIZATION, .REFUND.
splitTransfers[SplitTransfer]?NoSplit the transaction across multiple merchants. Requires ROLE_PARTNER credentials.
tagsResourceTags?NoCustom key-value metadata attached to the transaction.
buyerIdentityIdString?NoFinix Identity ID of the buyer.
surchargeAmountInt?NoOptional surcharge amount in cents. The SDK passes this value through as-is — surcharge logic must be handled by your application.
tipAmountInt?NoOptional tip amount in cents. The SDK passes this value through as-is — tip logic must be handled by your application.
signaturePendingBool?NoSet to true if a signature will be captured and submitted via /signature_uploads for this transfer.

Currency

Currency

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

Currency(amount: Int, code: CurrencyCode)
ParameterDescription
amountInteger amount in the smallest currency unit (cents for USD). For example, 1000 represents $10.00.
codeISO currency code. Use .USD for US dollars.

Completion handler

Completion handler

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

ParameterTrigger
transferResponseTransaction approved. Contains the transfer and authorization details.
errorTransaction declined or failed. Check error.localizedDescription for details.
let amount = Currency(amount: 1000, code: .USD) // $10.00
finixClient.startTransaction(amount: amount, type: .SALE) { response, error in
    Task { @MainActor in
        // handle response and error
    }
}

let amount = Currency(amount: 1000, code: .USD) // $10.00

// Convert from a decimal string (e.g., "10.00")
if let amountDouble = Double("10.00") {
    let amount = Currency(amount: Int(amountDouble * 100), code: .USD)
}

let amount = Currency(amount: 1000, code: .USD)
finixClient.startTransaction(amount: amount, type: .SALE) { response, error in
    Task { @MainActor in
        if let error = error {
            // transaction declined or failed
            print("Error: \(error.localizedDescription)")
            return
        }
        if let response = response {
            // transaction approved — response contains transfer details
            print("Transfer ID: \(response.id ?? "")")
        }
    }
}