Completion
1 min
When ToroConfig.captureMode is set to CaptureMode.MANUAL you need to send completion advice to the Toro gateway in order to capture the payment. This can be done 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.sendCompletionAdvice(
originalTransaction = originalTransactionDetails,
onCompleted = { response ->
println("Completion advice response received: ${response.name}")
},
onError = { error ->
println("Completion advice error: $error")
}
)