For the complete documentation index, see llms.txt. This page is also available as Markdown.

Game.setLeaderboardScore

Functional API submitGameCenterLeaderBoardScoreYou can use the same feature with it as well.

Feature description

Submits the user's game score from the game app to the Toss Game Center leaderboard. scoremust be passed as a string in floating-point form. For example "123.45" or "9999".

Toss app Android/iOS 5.221.0 It can be used on versions above that. In environments where a bridge response cannot be received, undefinedmay be returned.

Type

Game.setLeaderboardScore(params: { score: string }): Promise<SubmitGameCenterLeaderBoardScoreResponse | undefined>;

Params

{
  score: string;
}

Response

type SubmitGameCenterLeaderBoardScoreResponse = {
  statusCode:
    | "SUCCESS"
    | "LEADERBOARD_NOT_FOUND"
    | "PROFILE_NOT_FOUND"
    | "UNPARSABLE_SCORE";
};

Response statusCode Value:

statusCode
Description

SUCCESS

Score submission succeeded

LEADERBOARD_NOT_FOUND

Could not find the leaderboard

PROFILE_NOT_FOUND

The user's profile does not exist

UNPARSABLE_SCORE

The score could not be parsed. It must be passed as a string in floating-point (float) form.

Error

If called from a mini app rather than a game app, the Promise is rejected. In this case error.messageis "The leaderboard API can only be used in game apps.".

Example code

Was this helpful?