Call startRefund() to process a referenced refund against a previous transaction.
Function signature
finixClient.startRefund(
transactionID: String,
amount: Currency,
completion: ((RefundResponse?, Error?) -> Void)?
)| Parameter | Type | Required | Description |
|---|---|---|---|
transactionID | String | Yes | The ID of the original transaction to refund. |
amount | Currency | Yes | Amount to refund in cents. Cannot exceed the original transaction amount. |
completion | ((RefundResponse?, Error?) -> Void)? | No | Called with the refund result or an error. |
Completion handler
| Parameter | Trigger |
|---|---|
RefundResponse | Refund approved. Contains the refund details. |
Error | Refund 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 ?? "")")
}
}
}