chart-networkReferral Codes

Manage user referral codes through the Fuul SDK. These methods let you list, generate, check, and use referral codes as well as get invitation statuses.

List invite codes

To get the invite codes for a user use the listUserInviteCodes method.

const result = await Fuul.listUserReferralCodes({
  user_identifier: '0x12345',
  user_identifier_type: UserIdentifierType.EvmAddress,
});

Invitation Status

This method gets the invitation status of the user, including whether they were invited and with which code.

const status = await Fuul.getInvitationStatus({
  user_identifier: '0x12345',
  user_identifier_type: UserIdentifierType.EvmAddress
});

if (status.invited) {
  console.log('User was referred with code:', status.code);
}

Check Referral Code

To check whether a code is free to use the checkReferralCode method.

Accept Referral

To accept the referral and consume the code use the useReferralCode method.

The signed message should have the following structure: I am using invite code ${code}

circle-info

Requiring users to sign a message ensures event validity and disclosure to the user. This is mandatory as it prevents fraud.

Delete Referral

To delete the user that the referred use the deleteReferral method. The referral code usage number will be incremented by one.

The signed message should have the following structure:

I am deleting referral for user ${user_identifier} from code ${code}

Last updated