Guides

Reward Achievement Control

How to Use Rewards

This guide explains how to integrate the reward feature provided by Saucelive with your own coupon system.

The reward-related UI can be managed directly in the Live Console.
For detailed instructions on how to register and configure rewards, please refer to the Reward guide - Live console .

Once a user clicks Join for a registered reward, the CLICK button will appear after 1 minute.

📘

The url field must be configured.

When the user clicks the CLICK button, you can receive the corresponding data using the following code:

    ...
    case "sauceflexMoveReward":
      console.log("Reward Completion Link Data", jsonData.params.linkUrl);
      break;

Reward Usage Example

The following is a sample implementation for handling reward completion.
You can check whether the user is logged in within your internal logic, and upon clicking the reward button, trigger your custom reward API or download link.

case "sauceflexMoveReward": {
  const rewardLink = jsonData.params.linkUrl;

  // If You Operate Your Own API Server,below is an example of how to handle different outcomes:
  if (isLogin && memberData) {
    fetch(`${YOUR_REWARD_API}/${memberData}`)
      .then((res) => res.json())
      .then((res) => {
        if (res.success) {
          window.alert("Reward points have been successfully issued.");
        } else {
          window.alert("All reward points have been claimed.");
        }
      })
      .catch(() => {
        window.alert("An error occurred while issuing reward points.");
      });
  } else {
    location.href = rewardLink;
  }
  break;
}