PaymentStateSubscription

@ObjCName(name = "TeyaPaymentStateSubscription", exact = true)
interface PaymentStateSubscription

PaymentStateSubscription is a handler to a payment which is "in progress". It allows for:

  • subscribing (and unsubscribing) to state changes

  • cancelling the payment (unsupported by some implementations and also best effort, can be ignored by the Teya payment app)

  • get information about the state (see PaymentStateDetails)

PosLink specifics:

  • Pass com.teya.unifiedepossdk.poslink.TeyaPosLinkPaymentInProgressUi to the subscribe call to make Teya UI show up while the payment is in progress. You can also use unsubscribe with that same instance to hide the UI, although usually that shouldn't be needed as the UI hides itself after a final state (with some extra configurable delay).

Types

Link copied to clipboard
@ObjCName(name = "TeyaPaymentCancellationResult", exact = true)
enum CancellationResult : Enum<PaymentStateSubscription.CancellationResult>

Enum representing the result of the cancellation attempt.

Link copied to clipboard
data class CancellationResultInfo(val result: PaymentStateSubscription.CancellationResult, val debugErrorMessage: String?)

Represents the result of a payment cancellation attempt.

Link copied to clipboard
@ObjCName(name = "TeyaInProgressState", exact = true)
enum InProgressState : Enum<PaymentStateSubscription.InProgressState>

Enum representing the sub-state for PaymentState.InProgress of the payment. It provides more information about the current in progress payment and what is happening in the Teya payment application.

Link copied to clipboard
@ObjCName(name = "TeyaPaymentState", exact = true)
enum PaymentState : Enum<PaymentStateSubscription.PaymentState>

Enum representing the main state of the payment.

Link copied to clipboard
@ObjCName(name = "TeyaPaymentStateChangeListener", exact = true)
interface PaymentStateChangeListener

Listener for payment state changes.

Link copied to clipboard
@ObjCName(name = "TeyaPaymentStateDetails", exact = true)
data class PaymentStateDetails(val eposTransactionId: String, val amount: Int, val tip: Int?, val currency: String, val state: PaymentStateSubscription.PaymentState, val inProgressState: PaymentStateSubscription.InProgressState?, val gatewayPaymentId: GatewayPaymentId? = null, val reason: PaymentStateSubscription.PaymentStateReason? = null, val debugErrorMessage: String? = null, val metadata: PaymentStateSubscription.PaymentStateDetails.Metadata? = null, val transactionTimestamp: Long? = null, val wasUnsubscribed: Boolean = false)

Class holding all information about the state of the payment.

Link copied to clipboard
@ObjCName(name = "TeyaPaymentStateReason", exact = true)
enum PaymentStateReason : Enum<PaymentStateSubscription.PaymentStateReason>

Enum representing the reason for the current payment state.

Properties

Link copied to clipboard

Returns the current state of the payment. PaymentStateDetails

Functions

Link copied to clipboard

Cancels the ongoing payment request. This is a best effort call, meaning that the Teya payment app may ignore this request, if, for example, it is too late to cancel it.

Link copied to clipboard

Subscribes the listener to receive state change updates. Some states may be skipped by some implementations, don't assume that you'll get notified for each individual intermediate state.

Link copied to clipboard

Unsubscribes the listener from receiving state change updates.

Link copied to clipboard
abstract fun unsubscribeAll()

Calls unsubscribe for all current listeners.