Interacting with Lucra Headless Functionality

After the user logs into the Lucra SDK through the experience, the following headless methods are available to interact with user configuration, Games, Tournaments, Sports Matchups, and more.

Begin interacting with headless functions by obtaining an instance of LucraClient via its singleton reference LucraClient() or LucraClient.getInstance(). Both are functionally equivalent; getInstance() may be more convenient for Java consumers.

All headless functions return a sealed class type, enforcing exhaustive when statements to ensure all outcomes—including errors—are handled predictably.

⚠️ Initialize first: Headless calls will fail if invoked before the SDK finishes initializing. Gate your calls with waitForLucraClient:

  • Coroutine (Kotlin):

    CoroutineScope(Dispatchers.Main).launch {
      val lucraClient = LucraClient.waitForLucraClient()
      // now safe to make headless calls
    }
  • Callback (Java/Kotlin):

    LucraClient.waitForLucraClient(
        () -> {
          // now safe to make headless calls
        },
        throwable -> {
          // optional failure handling
        }
    );

See initialization details in Initialize the LucraClientarrow-up-right.


See here

See here

Observe the Lucra SDK User

Description: Observe the active SDKUser based on authentication status. Useful for determining when the user is logged in.

Methods:

  • observeSDKUserFlow() — coroutine-based

  • observeSDKUser(callback) — callback-based

Example:

Response Type: SDKUserResult


Configure User Properties

Description: Pushes profile attributes into Lucra for the currently authenticated user. Only non-null values on the supplied SDKUser are submitted.

If configure is invoked before the Lucra session is established, the request is queued and automatically retried after login. Deprecated properties such as birthday are ignored. Any values sent here are also surfaced inside LucraFlow.VerifyIdentity, minimizing what the user must re-enter during KYC.

Phone number implications

  • Provide phoneNumber only when you intend to bind the Lucra account to that value. After the number is verified, the SDK login flow requires the same phone for future authentications.

  • Skip the field (or pass null) if you prefer Lucra to collect and manage the phone number directly.

  • Whatever value you send appears pre-filled in the Verify Identity flow.

User metadata implications

  • Use metadata to pass identifiers and traits from your system. This is a Map of Strings to Strings, an external_id entry (example: "external_id" to clientUserId) is recommended at minimum to bind your users to Lucra users. Which will help for score submission and other identifying properties from Lucra systems.

Method:

  • configure(SDKUser, onResult: (SDKUserResult) -> Unit)

Example:

Response Type: SDKUserResult


Logout User

Description: Logs out the current user if one is authenticated.

Method:

  • logout(context)

Example:

Response Type: Unit


Get User's KYC Status

Description: Returns whether the current user is KYC-verified. Useful for checking ahead of launching money or matchup interactions. Most flows will automatically handle verification.

Method:

  • checkUsersKYCStatus(userId: String, lucraKYCStatusListener: LucraKYCStatusListener)

Example:

Response Type:

  • onKYCStatusAvailable(isVerified: Boolean)

  • onKYCStatusCheckFailed(exception: Exception)


Update Username

Description: Updates the username for the current SDKUser. If the new username is the same as the current one, the operation will return InvalidUsername. Throws IllegalStateException if the Lucra SDK has not been properly initialized.

Method:

  • updateUsername(sdkUser: SDKUser, newUsername: String, onResult: (SDKUserResult) -> Unit)

Example:

Last updated