Skip to content

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.

FrakClient

The current Frak Client

Optional cache configuration

number

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

Promise<UserReferralStatusType | null>

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

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