GYP Headless Functions
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— Missingtypeor required fields for the given reward type (e.g., cash amount).invalidRewardType—typeis notcashortenantreward.invalidPlayStyle— Play style is notgroupvsgrouporfreeforall.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:
insufficientFundsnotAllowednotInitializedunverifiedmissingDemographicInformationlocationErrorapiErrorunknown/unknownError
Accept Free-for-All Recreational Game
Parameters:
matchupId(string): Matchup to accept.
Errors that can be thrown:
insufficientFundsnotAllowednotInitializedunverifiedmissingDemographicInformationlocationErrorapiErrorunknown/unknownError
Cancel Games Matchup
Parameters:
matchupId(string): Matchup ID to cancel.
Errors that can be thrown:
notAllowednotInitializedunverifiedmissingDemographicInformationlocationErrorapiErrorunknown/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:
locationErrorapiErrorunknown/unknownError
Example response:
Last updated
