Mobile SDK
...
Transactions
Refund
2 min
it is important to note that refunds are still a work in progress, therefore minor changes to the sdk may be required in future releases starting a refund refunds work very similarly to docid\ xftyvcscnepqsmjfz6o4a , with a few key differences the transactiontype must be specified as refund when calling toro starttransaction() there needs to be an existing purchase to refund some details of the original purchase are required in order to initiate the refund the refund amount cannot be more than the original purchase amount gratuities are not applicable the refund amount cannot be greater than the original purchase amount toro starttransaction( amount = 1000, type = transactiontype refund currencycode = currencycode gbp, metadata = transactionmetadata( originaltransactiondetails = originaltransactiondetails ), oncompleted = { receipt > println("transaction completed ${receipt transactionid}") }, oncancelled = { cancellationtype > when (cancellationtype) { cancellationtype attendant > println("transaction cancelled in app") cancellationtype customer > println("transaction cancelled on miura device") } }, onerror = { error > when (error) { is devicenotselected > handledeviceerror(error) is deviceconnectionfailed > reconnectdevice() is devicedisconnected > showreconnectionprompt() else > showerrormessage(error message) } } )toro starttransaction( 1000, // £10 00 transactiontype refund, currencycode gbp, new transactionmetadata( null, 0, originaltransactiondetails, collections emptymap() ), result > { // handle successful transaction system out println("transaction completed " + result); return null; }, cancellationtype > { if (cancellationtype == cancellationtype attendant) { system out println("transaction cancelled in app"); } else if (cancellationtype == cancellationtype customer) { system out println("transaction cancelled on miura device"); } return null; }, error > { if (error instanceof toroexception devicenotselected) { handledeviceerror((toroexception devicenotselected) error); } else if (error instanceof toroexception deviceconnectionfailed) { reconnectdevice(); } else if (error instanceof toroexception devicedisconnected) { showreconnectionprompt(); } else { showerrormessage(error getmessage()); } return null; }, (gratuityamount, gratuitypercentage) > { // handle gratuity confirmation system out println("gratuity added £" + (gratuityamount / 100 0) + " (" + gratuitypercentage + "%)"); return null; } ); below is an example originaltransactiondetails object which needs to be passed through the transactionmetadata 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" )
