Skip to content

Refunds

Call startRefund() to process a referenced refund against a previous transaction.

Function signature

finixClient.startRefund(
    transactionID: String,
    amount: Currency,
    completion: ((RefundResponse?, Error?) -> Void)?
)
ParameterTypeRequiredDescription
transactionIDStringYesThe ID of the original transaction to refund.
amountCurrencyYesAmount to refund in cents. Cannot exceed the original transaction amount.
completion((RefundResponse?, Error?) -> Void)?NoCalled with the refund result or an error.

Completion handler

Completion handler

ParameterTrigger
RefundResponseRefund approved. Contains the refund details.
ErrorRefund failed. Check error.localizedDescription for details.
let refundAmount = Currency(amount: 1000, code: .USD) // $10.00
finixClient.startRefund(transactionID: "TRxxxxxx", amount: refundAmount) { response, error in
    Task { @MainActor in
        // handle response and error
    }
}

let refundAmount = Currency(amount: 1000, code: .USD)
finixClient.startRefund(transactionID: "TRxxxxxx", amount: refundAmount) { response, error in
    Task { @MainActor in
        if let error = error {
            print("Refund failed: \(error.localizedDescription)")
            return
        }
        if let response = response {
            // refund approved
            print("Refund ID: \(response.id ?? "")")
        }
    }
}