Skip to content

Documentation / @frak-labs/core-sdk / actions / getUserReferralStatus

Function: getUserReferralStatus()

getUserReferralStatus(client, options?): Promise<UserReferralStatusType | null>

Defined in: actions/getUserReferralStatus.ts:28

Fetch the current user's referral status on the current merchant.

The listener resolves the user's identity (via clientId or wallet session) and checks whether a referral link exists where the user is the referee.

Results are cached in memory for 30 seconds by default. Concurrent calls while a request is in-flight are deduplicated automatically.

Returns null when the user's identity cannot be resolved.

Parameters

client

FrakClient

The current Frak Client

options?

Optional cache configuration

cacheTime?

number

Time in ms to cache the result. Default: 30_000 (30s). Set to 0 to disable.

Returns

Promise<UserReferralStatusType | null>

The user's referral status, or null if identity cannot be resolved

Example

const status = await getUserReferralStatus(client);
if (status?.isReferred) {
  console.log("User was referred to this merchant");
}