GYP Headless Functions

Lucra Headless setup

Use these APIs to manage Games You Play (recreational) matchups without showing Lucra UI. All calls require LucraSDK.init to be completed and the user configured.

Create Recreational Game

const { matchupId } = await LucraSDK.createRecreationalGame(
  'GAME_TYPE_ID',
  {
    type: 'cash',
    amount: 10,
  },
  'groupvsgroup'
);

Parameters:

  • gameTypeId (string): Lucra game type identifier.

  • atStake (object): Reward payload. Supported shapes:

    • Cash: { type: 'cash', amount: number }

    • Tenant reward: { type: 'tenantreward', rewardId, title, descriptor, iconUrl, bannerIconUrl?, disclaimer?, metadata?: Record<string,string> }

  • playStyle (string): 'groupvsgroup' or 'freeforall' (case-insensitive).

Returns: { matchupId: string }

Example response:

Errors that can be thrown:

  • invalidAtStake — Missing type or required fields for the given reward type (e.g., cash amount).

  • invalidRewardTypetype is not cash or tenantreward.

  • invalidPlayStyle — Play style is not groupvsgroup or freeforall.

  • insufficientFunds — User has insufficient funds.

  • notAllowed — User is not allowed to perform such operation.

  • notInitialized — User has not been initialized.

  • unverified — User has not been verified.

  • missingDemographicInformation — User has missing demographic information.

  • locationError — Location restriction or geo/permission issue.

  • apiError — Server/network error message from backend.

  • unknown / unknownError — Unclassified failure from native SDK.

Handling example:

Accept Versus Recreational Game

Parameters:

  • matchupId (string): Matchup to accept.

  • teamId (string): Team side to join.

Errors that can be thrown:

  • insufficientFunds

  • notAllowed

  • notInitialized

  • unverified

  • missingDemographicInformation

  • locationError

  • apiError

  • unknown / unknownError

Accept Free-for-All Recreational Game

Parameters:

  • matchupId (string): Matchup to accept.

Errors that can be thrown:

  • insufficientFunds

  • notAllowed

  • notInitialized

  • unverified

  • missingDemographicInformation

  • locationError

  • apiError

  • unknown / unknownError

Cancel Games Matchup

Parameters:

  • matchupId (string): Matchup ID to cancel.

Errors that can be thrown:

  • notAllowed

  • notInitialized

  • unverified

  • missingDemographicInformation

  • locationError

  • apiError

  • unknown / unknownError

Get Matchup

Parameters:

  • matchupId (string): Lucra matchup identifier.

Returns: MatchupInfo (includes participants, teams, status, and recreationGameExtension with game/buy-in details where available).

Errors that can be thrown:

  • locationError

  • apiError

  • unknown / unknownError

Example response:

Last updated