FrameNetworking

Central SDK singleton. Initialize once with initializeWithAPIKey from your Application.onCreate before using any Frame UI component or API client.

Samples

Properties

Link copied to clipboard

The publishable key set during initializeWithAPIKey. Used for client-safe API calls.

Link copied to clipboard

The secret key set during initializeWithAPIKey. Used as the Bearer token for most API calls.

Link copied to clipboard

HTTP session used for all suspend-based API calls. Replace in tests to inject a mock.

Link copied to clipboard
const val CURRENT_VERSION: <Error class: unknown class>

The current SDK version string, sourced from BuildConfig.

Link copied to clipboard

When true, request URLs, request bodies, and response bodies are printed to logcat.

Link copied to clipboard

Google Pay merchant identifier, captured at SDK init and read by every Google Pay surface (FrameGooglePayButton, the bundled checkout, onboarding's wallet attach). Null until set.

Link copied to clipboard
val gson: Gson

Gson instance shared across all SDK API clients.

Link copied to clipboard

true once Evervault has been successfully configured; false until then.

Link copied to clipboard

Base URL for all Frame API requests. Defaults to the production endpoint.

Link copied to clipboard
val okHttpClient: OkHttpClient

Shared OkHttp client configured with Frame's standard timeouts.

Functions

Link copied to clipboard

Applies Evervault credentials when both team id and app id are present. Returns false if config is missing or invalid (do not use Evervault card inputs until this returns true).

Link copied to clipboard

Loads Evervault credentials from secure storage or the Frame API (callback-based variant). Prefer ensureEvervaultReadyForCardInputs from a coroutine when possible.

Link copied to clipboard

Returns the current Sonar session identifier, or null if Sonar has not been initialized.

Link copied to clipboard

Loads Evervault config from secure storage or the Frame API, then applies it. Call from a coroutine before showing Evervault RowsPaymentCard / EncryptedPaymentCardInput.

Link copied to clipboard

Returns the application context stored during initializeWithAPIKey.

Link copied to clipboard
fun initializeWithAPIKey(context: Context, secretKey: String, publishableKey: String, googlePayMerchantId: String? = null, debug: Boolean = false)

Initializes the Frame SDK. Call once from Application.onCreate before using any SDK component.

Link copied to clipboard
inline fun <T> parseListResponse(data: ByteArray?): List<T>?

Deserializes data from a JSON array into a list of T, or returns null on failure.

Link copied to clipboard
inline fun <T> parseResponse(data: ByteArray?): T?

Deserializes data from JSON into type T, or returns null on failure.

Link copied to clipboard
suspend fun performDataTask(endpoint: FrameNetworkingEndpoints, usePublishableKey: Boolean = false): Pair<ByteArray?, NetworkingError?>

Executes a GET or DELETE request to endpoint and returns the raw response bytes.

fun performDataTask(endpoint: FrameNetworkingEndpoints, usePublishableKey: Boolean = false, completion: (data: ByteArray?, error: NetworkingError?) -> Unit)

Callback-based GET/DELETE for callers that cannot use coroutines.

Link copied to clipboard
suspend fun performDataTaskWithRequest(endpoint: FrameNetworkingEndpoints, request: Any? = null, usePublishableKey: Boolean = false): Pair<ByteArray?, NetworkingError?>

Executes a POST or PATCH request to endpoint, serializing request as the JSON body.

fun <T> performDataTaskWithRequest(endpoint: FrameNetworkingEndpoints, request: T? = null, usePublishableKey: Boolean = false, completion: (data: ByteArray?, error: NetworkingError?) -> Unit)

Callback-based POST/PATCH for callers that cannot use coroutines.

Link copied to clipboard
suspend fun performMultipartDataTask(endpoint: FrameNetworkingEndpoints, filesToUpload: List<FileUpload>, usePublishableKey: Boolean = false): Pair<ByteArray?, NetworkingError?>

Executes a multipart POST to endpoint, uploading each FileUpload as a form-data part.

fun performMultipartDataTask(endpoint: FrameNetworkingEndpoints, filesToUpload: List<FileUpload>, usePublishableKey: Boolean = false, completion: (data: ByteArray?, error: NetworkingError?) -> Unit)

Callback-based multipart POST for callers that cannot use coroutines.