Showing Payment Result


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


The YocoSDK.showPaymentResult() is an optional API flow that will show the user a success or error screen.


  1. context: Context - The calling Activity/Fragment initiating the payment
  2. paymentResult: PaymentResult - result returned from [YocoSDK.getPaymentResult()]
  3. params: PaymentParameters - (Optional) Provides additional info regarding the payment
    1. receiptDelegate: ReceiptDelegate? - (Optional) Receipt screen callback handler and util
  4. result: ActivityResultLauncher<Intent>? - (Optional) activity result handler contract to handle intent result

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


Before calling the SDK showPaymentResult() method, you will first need to retrieve the PaymentResult from the SDK getPaymentResult(), which can then be passed as a parameter to show the user a success or error screen based on that transaction.

import com.yoco.payment_ui_sdk.YocoSDK
// Required:
val paymentResult: PaymentResult = <Result from Yoco.getPaymentResult()>
// Optional: Params containing additional for advanced functionality
val params = PaymentParameters(
receiptDelegate = this
// Initiating showing the Payment Result
context = requireContext(),
paymentResult = paymentResult,
params = params,
result = lastTransactionResult

If no user has logged in, you WILL be prompted to login using your Yoco account details. If successful, it will continue to the payment flow.

Handling Receipts

Handling Payment Result