Refunding a payment
Basic usage
To refund a payment, invoke the refund function, providing the transactionId that was returned
to you when you processed the payment. This requires an authenticated user with the correct refund
permissions to be able to perform a refund.
If no user has logged in, you are prompted to login using your Yoco account details. If successful, it continues to the refund flow.
Advanced usage
This example shows you some of the extra capabilities you can add to your use of the SDK by adding a
RefundParameters object to the refund function call.
The context that’s passed as a parameter must be calling activity/fragment’s context and not the
application context.
Finalise the payment
When calling the YocoSDK.refund() method without a ActivityResultLauncher, and instead handling
the PaymentResult in onActivityResult, the RequestCode is assigned the
PaymentResultInfo.RequestCode.REFUND_REQUEST value.
To finalise the payment using the ActivityResultLauncher contract, see
how to finalise the payment.