# Package-level declarations

Core classes used by all the SDK components.

## Types

Callback
Link copied to clipboard
fun interface Callback<R>

Communicates the result of an asynchronous operation. onResult will be invoked exactly once per operation on the application's main (UI) thread.

CallbackReference
Link copied to clipboard
fun interface CallbackReference

A reference to a Mobile Payments SDK Callback that can be cleared to prevent memory leaks. It is recommended to clear the reference any time a lifecycle destroy event occurs (e.g. android.app.Activity.onDestroy or `ViewModel.onCleared()`). It can also be cleared when the Callback is no longer needed and should not be invoked.

ErrorCode
Link copied to clipboard
interface ErrorCode

Implemented by error code enums that are returned as a result of Mobile Payments SDK operations.

ErrorDetails
Link copied to clipboard
class ErrorDetails(val category: String, val code: String, val detail: String, val field: String? = null)

Detailed errors to explain a failure. Typically these are returned from Square's Connect v2 REST APIs, and are documented here. However, there may be conditions where an error is generated by the SDK itself, for example to explain errors that prevented server or cardreader communication.

Result
Link copied to clipboard
sealed class Result<S, C>

The result of an asynchronous operation.

TimeOfDay
Link copied to clipboard
data class TimeOfDay(val hour: Int, val minute: Int)

Represents a time of day with hour and minute components.