defer Payment Refund
Collects a card PIN for an EBT payment and defers the refund of the payment to the server.
On success, the
data
property of the ForageApiResponse.Success object resolves with an empty string.On failure, the response includes a list of ForageError objects that you can unpack to troubleshoot the issue.
// Example deferPaymentRefund call in a PosDeferPaymentRefundViewModel.kt
class PosDeferPaymentRefundViewModel : ViewModel() {
var paymentRef: String = ""
fun deferPaymentRefund(foragePinEditText: ForagePINEditText) = viewModelScope.launch {
val forageTerminalSdk = ForageTerminalSDK.init(...) // may throw!
val deferPaymentRefundParams = PosDeferPaymentRefundParams(
foragePinEditText,
paymentRef
)
val response = forage.deferPaymentRefund(deferPaymentRefundParams)
when (response) {
is ForageApiResponse.Success -> {
// do something with response.data
}
is ForageApiResponse.Failure -> {
// do something with response.errors
}
}
}
}
Content copied to clipboard
Return
A ForageAPIResponse indicating the success or failure of the PIN capture.
Parameters
params
The PosRefundPaymentParams parameters required for refunding a Payment.
See also
Defer EBT payment capture and refund completion to the server for the related step-by-step guide.
Throws
If the passed ForagePINEditText instance hasn't had its ForageConfig set via .setForageConfig().