Lookup Last Transaction

When calling YocoSDK.getPaymentResult(), this will query a transaction using the transactionId and will return a PaymentResult with the available transaction details. This could typically be used in the event that the app crashes or is terminated during a transaction, it is useful to know what happend to the transaction that was in progress. To look up the state of a previous transaction.

Parameters

  1. transactionId: String - The ID of the transaction you want to get the result for.
  2. completionHandler: ((resultCode: Int, paymentResult: PaymentResult?) -> Unit) - The callback function to be notified of when it has been fetched.

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
// Async call
YocoSDK.getPaymentResult(transactionIdStr) { resultCode: Int, result: PaymentResult? ->
// Use result of transaction if available
}
note

This will allow you to get the PaymentResult of the transaction so you can determine if it was a success or failure.

Handling Payment Result