Showing Payment Result

info

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

note

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

Parameters

  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
danger

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

Usage

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
import com.yoco.payment_ui_sdk.data.result.PaymentResult
import com.yoco.payment_ui_sdk.data.params.PaymentParameters
// 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
YocoSDK.showPaymentResult(
context = requireContext(),
paymentResult = paymentResult,
params = params,
result = lastTransactionResult
)
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 payment flow.

Handling Receipts

Handling Payment Result