Cancellation
1 min
To cancel an authorisation which has not yet cleared, you can send cancellation advice to the Toro gateway as shown below.
val originalTransactionDetails = OriginalTransactionDetails(
saleReferenceId = "sale-12345",
amount = 1000,
currency = CurrencyCode.GBP,
dateTime = "2025-01-01T00:00:00.000Z",
transactionReference = "purchase_12345123",
responseCode = ResponseCode.APPROVED,
authCode = "123456",
paymentInterface = PaymentInterface.CONTACT,
terminalSerialNumber = "2110022",
additionalResponseInformation = "01:XZZ022a3a0a9a99f1B5MXJYICT525HCF"
)
toro.sendCancellationAdvice(
originalTransaction = originalTransactionDetails,
onCompleted = { response ->
println("Cancellation advice response received: ${response.name}")
},
onError = { error ->
println("Cancellation advice error: $error")
}
)