Free to Play Support

Free to play, reward based matchups will depend on a rewardProvider to be registered with the LucraClient at runtime. This allows users to select rewards to play for in matchup creation.

This approach allows you interact with remote services to identify what rewards are availble for the current user to attach to their matchup.

Reward Provider

Register reward callbacks so Lucra can show and claim rewards after a matchup.

import { registerRewardProvider, type LucraReward } from '@lucra-sports/lucra-react-native-sdk';

async function getAvailableRewards(): Promise<LucraReward[]> {
  return [
    {
      rewardId: 'Reward123',
      title: 'My awesome reward',
      descriptor: 'descriptor',
      iconUrl: 'http://url.com/blah.jpg',
      bannerIconUrl: 'another jpg url',
      disclaimer: 'disclaimer',
      metadata: JSON.stringify({ otherData: 'you want' }),
    },
  ];
}

async function claimReward(reward: LucraReward) {
  // Allow the user to view the details of the reward.
}

function viewRewards() {
  // Show the users the rewards
}

LucraClient.registerRewardProvider(getAvailableRewards, claimReward, viewRewards);

Last updated