Referral System
Last updated
Last updated
The referral system can be configured for a specific project in the metapro system. When a user provides a referral code during registration, it indicates that the owner of the referral code will receive bonuses from their downline based on each score earned, according to the percentage set in the referral project settings.
The Fetch Referral Code action retrieves the user's referral code from the referral system if one exists. It makes an API request using the user's ID and project ID to check if a referral code is associated with the user. If a referral code is found, it sets the code to a local variable and triggers the On Referral Code Exists condition. If no referral code is found, it triggers the On Referral Code Empty condition. The retrieved referral code can be accessed using the Get Referral Code expression.
The Generate Referral Code action generates a new referral code for the user within the referral system. It sends a POST request with the user's ID and project ID to create the code. If the operation is successful, the generated referral code is saved to a local variable, and the On Referral Code Generated condition is triggered. However, if the user already has an existing referral code, this action will result in an error, as only one referral code can be associated with a user. The newly generated code can be accessed through the Get Referral Code expression.
The Request Referral Structure action retrieves the user's referral downline structure from the leaderboard system, including the bonus points and percentages set for each level. It sends a request to obtain data such as the number of downline users at each level, the percentage of bonuses earned for each level, and the total bonus points accumulated. Upon successful retrieval, the On Referral Structure Received condition is triggered. The referral structure can be accessed using the Get Referral Structure expression, which returns the response as a stringified JSON object.