Refund Integrator
Usage
To refund a payment you will need to call the SDK refund()
method. This requires an authenticated user with the correct refund permissions to be able to perform a refund.
import com.yoco.payments.sdk.YocoSDK
import com.yoco.payments.sdk.data.YocoStaff
import com.yoco.payments.sdk.data.params.RefundParameters
// Optional: Additional user info
val userInfo = HashMap<String, Any>().apply {
this["UserId"] = "test01"
this["Title"] = "Manager"
}
// Optional: Params containing additional for advanced functionality
val params = RefundParameters(
staffMember = YocoStaff(name = "John", staffNumber = "007"),
receiptDelegate = this,
userInfo = userInfo,
refundCompleteNotifier = { _: Int, result: PaymentResult ->
// Do something once the refund is complete
}
)
// Initiating the refund
YocoSDK.refund(
context = requireContext(),
transactionId = <transactionId>,
params = params,
result = refundResult
)
note
If no user has logged in, you WILL be prompted to login using you Yoco account details. If successful, it will continue to the refund flow.