Refund Integrator

Usage

To refund a payment you will just need to call the SDK refund() method. This requires an authenticated user with the correct refund permissions to be able to perform a refund.

You may also optionally pass in an amountInCents to refund, in order to refund a portion of the total payment. If the amount is more than the amount still refundable, or the card that was used for the payment does not support partial refunds - then an error message will be shown to the user.

import com.yoco.payment_ui_sdk.YocoSDK
import com.yoco.payment_ui_sdk.data.YocoStaff
import com.yoco.payment_ui_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,
amountInCents = 500,
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.

Handling Receipts

Handling Payment Result