Refunding a Payment

info

When calling YocoSDK.refund() without passing in a ActivityResultLauncher and handling the PaymentResult in onActivityResult, it will be assigned the PaymentResultInfo.RequestCode.REFUND_REQUEST code

Parameters

  1. context: Context - The calling Activity/Fragment initiating the payment
  2. transactionId: String? - transactionId that should be refunded
  3. params: RefundParameters - (Optional) Provides additional info regarding the payment
    1. amountInCents: Long - (Optional) Optional partial amount to be refunded. Should be less than original transaction amount (minus already refunded amount, if any)
    2. receiptDelegate: ReceiptDelegate? - (Optional) Receipt screen callback handler and util
    3. userInfo: Map<String, Any>? - (Optional) Map of key-value pairs, providing additional info regarding the user which will be returned to the PaymentResult
    4. staffMember: YocoStaff? - (Optional) Yoco Staff member performing payment
    5. refundCompleteNotifier: ((resultCode: Int, result: PaymentResult) -> Unit)? - (Optional) refund completion handler
  4. result: ActivityResultLauncher<Intent>? - (Optional) activity result handler contract to handle intent result
danger

The context that is passed as a parameter MUST be calling activity/fragment's context and NOT the application context.