Convert to Credit

Convert to Credit allows users to turn Lucra cash into credits within your app. You must register a creditConversionProvider that returns the conversion offer displayed to the user.

This approach allows you interact with remote services to identify what kind of credit conversion is available for the current user.

Register the Provider

import { registerCreditConversionProvider } from '@lucra-sports/lucra-react-native-sdk';

registerCreditConversionProvider(async (cashAmount: number) => {
  const convertedAmount = cashAmount * 3;
  return {
    id: 'unique-id',
    type: 'game-credits',
    title: 'Game Credits',
    convertedAmount,
    iconUrl: 'https://my-image.com/image.png',
    convertedAmountDisplay: `${convertedAmount} credits`,
    shortDescription: 'Short description for the user.',
    longDescription: 'Longer description shown inside the conversion flow.',
    metaData: {
      foo: 'bar',
    },
    cardColor: '#5A1668',
    cardTextColor: '#FFFFFF',
    pillColor: '#5A1668',
    pillTextColor: '#FFFFFF',
  };
});

Provider Return Fields

  • id (string, required): Unique identifier for the conversion offer.

  • type (string, required): Internal identifier for the credit system.

  • title (string, required): Display title for the conversion option.

  • convertedAmount (number, required): Converted credit amount.

  • convertedAmountDisplay (string, required): Human-friendly display, e.g. "300 credits".

  • shortDescription (string, required): Short marketing copy.

  • longDescription (string, required): Detailed description.

  • iconUrl (string, optional): Icon URL.

  • metaData (object, optional): Additional data stored with the conversion.

  • cardColor, cardTextColor, pillColor, pillTextColor (string, optional): UI colors.

Last updated