> For the complete documentation index, see [llms.txt](https://wiki.playgama.com/playgama/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.playgama.com/playgama/bridge-sdk/api/daily-rewards.md).

# Daily Rewards

{% hint style="info" %}
You are reading the documentation for Bridge SDK **v2**. If you need the obsolete v1 documentation, see [Documentation (v1)](https://wiki.playgama.com/playgama/bridge-sdk-v1).
{% endhint %}

Daily login rewards: the game declares an ordered list of reward ids (one per day), and Bridge tracks the current day, claims, and streak resets.

## Configuration

Declare the rewards in the [config](/playgama/bridge-sdk/config.md) under the `dailyRewards` key:

```json
{
    "dailyRewards": {
        "rewards": ["100_coins", "200_coins", "1_gem", "300_coins", "2_gems", "500_coins", "5_gems"],
        "cycle": true,        // optional, default true — restart from day 1 after the last reward
        "resetOnMiss": true   // optional, default true — reset the streak when a day is missed
    }
}
```

## Get Rewards

Returns the configured ordered list of reward ids.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
const rewards = await bridge.dailyRewards.getRewards() // string[]
```

{% endtab %}

{% tab title="Unity" %}

```csharp
Bridge.dailyRewards.GetRewards((success, rewards) =>
{
    if (success)
    {
        // rewards is an ordered string[] of reward ids
    }
});
```

{% endtab %}

{% tab title="Construct 3" %}
Call the `Daily Rewards Get Rewards` action, then handle the `On Daily Rewards Get Rewards Completed` trigger. Read the result with the `DailyRewardsCount` and `DailyRewardsReward(index)` expressions, or take the whole list with `DailyRewardsAsJSON`.

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"daily-rewards-get-rewards","objectClass":"PlaygamaBridge"}]},{"eventType":"block","conditions":[{"id":"on-daily-rewards-get-rewards-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"for","objectClass":"System","parameters":{"name":"\"rewards\"","start-index":"0","end-index":"PlaygamaBridge.DailyRewardsCount - 1"}}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"PlaygamaBridge.DailyRewardsReward(loopindex(\"rewards\"))"}}]}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}
Call the `Daily Rewards Get Rewards` action, then handle the `On Daily Rewards Get Rewards Completed` condition. Read the result with the `PlaygamaBridge::DailyRewardsCount()` and `PlaygamaBridge::DailyRewardId(index)` expressions, or take the whole list with `PlaygamaBridge::DailyRewardsAsJSON()`.

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::DailyRewardsGetRewards"},"parameters":["",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnDailyRewardsGetRewardsCompleted"},"parameters":["",""]}],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["CurrentIndex","=","0"]}],"events":[{"type":"BuiltinCommonInstructions::Repeat","repeatExpression":"PlaygamaBridge::DailyRewardsCount()","conditions":[],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["PlaygamaBridge::DailyRewardId(CurrentIndex)","\"info\"",""]},{"type":{"value":"SetNumberVariable"},"parameters":["CurrentIndex","+","1"]}]}]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
Bridge.daily_rewards.get_rewards(funcref(self, "_on_get_rewards_completed"))

func _on_get_rewards_completed(success, rewards):
    if success:
        for reward in rewards:
            print(reward)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
Bridge.daily_rewards.get_rewards(Callable(self, "_on_get_rewards_completed"))

func _on_get_rewards_completed(success, rewards):
    if success:
        for reward in rewards:
            print(reward)
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_daily_rewards_get_rewards()

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_daily_rewards_get_rewards_callback" {
    if async_load[? "success"] {
        var rewards = json_parse(async_load[? "data"])
    }
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)
    bridge.daily_rewards.get_rewards(
        function (_, rewards_json)
            local rewards = json.decode(rewards_json)
            for _, reward in ipairs(rewards) do
                print(reward)
            end
        end,
        function ()
            -- error
        end
    )
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
const rewards = await bridge.dailyRewards.getRewards() // string[]
```

{% endtab %}
{% endtabs %}

## Get Current Day

Returns the 0-based index (into the rewards list) of the reward the player is currently on.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
const day = await bridge.dailyRewards.getCurrentDay() // number
```

{% endtab %}

{% tab title="Unity" %}

```csharp
Bridge.dailyRewards.GetCurrentDay((success, day) =>
{
    Debug.Log($"Current day: {day}");
});
```

{% endtab %}

{% tab title="Construct 3" %}
Call the `Daily Rewards Get Current Day` action, then handle the `On Daily Rewards Get Current Day Completed` trigger and read the `DailyRewardsCurrentDay` expression.

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"daily-rewards-get-current-day","objectClass":"PlaygamaBridge"}]},{"eventType":"block","conditions":[{"id":"on-daily-rewards-get-current-day-completed","objectClass":"PlaygamaBridge"}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"PlaygamaBridge.DailyRewardsCurrentDay"}}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}
Call the `Daily Rewards Get Current Day` action, then handle the `On Daily Rewards Get Current Day Completed` condition and read the `PlaygamaBridge::DailyRewardsCurrentDay()` expression.

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::DailyRewardsGetCurrentDay"},"parameters":["",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnDailyRewardsGetCurrentDayCompleted"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["ToString(PlaygamaBridge::DailyRewardsCurrentDay())","\"info\"",""]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
Bridge.daily_rewards.get_current_day(funcref(self, "_on_get_current_day_completed"))

func _on_get_current_day_completed(success, day):
    print(day)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
Bridge.daily_rewards.get_current_day(Callable(self, "_on_get_current_day_completed"))

func _on_get_current_day_completed(success, day):
    print(day)
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_daily_rewards_get_current_day()

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_daily_rewards_get_current_day_callback" {
    if async_load[? "success"] {
        var day = real(async_load[? "data"])
    }
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)
    bridge.daily_rewards.get_current_day(
        function (_, day)
            print(day)
        end,
        function ()
            -- error
        end
    )
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
const day = await bridge.dailyRewards.getCurrentDay() // number
```

{% endtab %}
{% endtabs %}

## Get Current Reward

Returns the id of the reward claimable **today**, or `null` when nothing can be claimed (already claimed today, or the streak is finished and `cycle` is off).

{% tabs %}
{% tab title="Plain JS" %}

```javascript
const reward = await bridge.dailyRewards.getCurrentReward() // string | null
```

{% endtab %}

{% tab title="Unity" %}

```csharp
Bridge.dailyRewards.GetCurrentReward((success, reward) =>
{
    if (success && reward != null)
    {
        // reward is claimable today
    }
});
```

{% endtab %}

{% tab title="Construct 3" %}
Call the `Daily Rewards Get Current Reward` action, then handle the `On Daily Rewards Get Current Reward Completed` trigger. The `Is Daily Rewards Current Reward Available` condition tells whether anything can be claimed; read the id with the `DailyRewardsCurrentReward` expression.

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"daily-rewards-get-current-reward","objectClass":"PlaygamaBridge"}]},{"eventType":"block","conditions":[{"id":"on-daily-rewards-get-current-reward-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"is-daily-rewards-current-reward-available","objectClass":"PlaygamaBridge"}],"actions":[{"id":"log","objectClass":"Browser","parameters":{"type":"log","message":"PlaygamaBridge.DailyRewardsCurrentReward"}}]}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}
Call the `Daily Rewards Get Current Reward` action, then handle the `On Daily Rewards Get Current Reward Completed` condition and read the `PlaygamaBridge::DailyRewardsCurrentReward()` expression (empty string when nothing can be claimed).

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::DailyRewardsGetCurrentReward"},"parameters":["",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnDailyRewardsGetCurrentRewardCompleted"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["PlaygamaBridge::DailyRewardsCurrentReward()","\"info\"",""]}]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
Bridge.daily_rewards.get_current_reward(funcref(self, "_on_get_current_reward_completed"))

func _on_get_current_reward_completed(success, reward):
    if success and reward != null:
        # reward is claimable today
        print(reward)
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
Bridge.daily_rewards.get_current_reward(Callable(self, "_on_get_current_reward_completed"))

func _on_get_current_reward_completed(success, reward):
    if success and reward != null:
        # reward is claimable today
        print(reward)
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_daily_rewards_get_current_reward()

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_daily_rewards_get_current_reward_callback" {
    if async_load[? "success"] {
        var reward = async_load[? "data"] // undefined when nothing can be claimed
    }
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)
    bridge.daily_rewards.get_current_reward(
        function (_, reward)
            if reward then
                -- reward is claimable today
                print(reward)
            end
        end,
        function ()
            -- error
        end
    )
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
const reward = await bridge.dailyRewards.getCurrentReward() // string | null
```

{% endtab %}
{% endtabs %}

## Claim Current Reward

Claims today's reward. Resolves to `true` on success and advances the streak, or `false` when nothing is claimable.

{% tabs %}
{% tab title="Plain JS" %}

```javascript
bridge.dailyRewards.claimCurrentReward()
    .then(() => {
        // grant the current reward
    })
```

{% endtab %}

{% tab title="Unity" %}

```csharp
Bridge.dailyRewards.ClaimCurrentReward(claimed =>
{
    if (claimed)
    {
        // grant the current reward
    }
});
```

{% endtab %}

{% tab title="Construct 3" %}
Call the `Daily Rewards Claim Current Reward` action, then handle the `On Daily Rewards Claim Current Reward Completed` trigger — `Is Last Action Completed Successfully` is true only when the reward was actually claimed.

<details>

<summary>Copy This Example</summary>

```
{"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"on-clicked","objectClass":"Button"}],"actions":[{"id":"daily-rewards-claim-current-reward","objectClass":"PlaygamaBridge"}]},{"eventType":"block","conditions":[{"id":"on-daily-rewards-claim-current-reward-completed","objectClass":"PlaygamaBridge"}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"is-last-action-completed-successfully","objectClass":"PlaygamaBridge"}],"actions":[{"type":"comment","text":"claimed - grant the current reward"}]}]}]}
```

</details>
{% endtab %}

{% tab title="GDevelop" %}
Call the `Daily Rewards Claim Current Reward` action, then handle the `On Daily Rewards Claim Current Reward Completed` condition — `Is Last Action Completed Successfully` is true only when the reward was actually claimed.

<details>

<summary>Copy This Example</summary>

```
{"000kind":"GDEVELOP_EventsAndInstructions_CLIPBOARD_KIND-jsBdHbLy912y8Rc","content":{"eventsList":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["Button",""]}],"actions":[{"type":{"value":"PlaygamaBridge::DailyRewardsClaimCurrentReward"},"parameters":["",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::OnDailyRewardsClaimCurrentRewardCompleted"},"parameters":["",""]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlaygamaBridge::IsLastActionCompletedSuccessfully"},"parameters":["",""]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"claimed\"","\"info\"",""]}]}],"actions":[]}],"eventsCount":2,"actionsList":[],"actionsCount":0,"conditionsList":[],"conditionsCount":0}}
```

</details>
{% endtab %}

{% tab title="Godot" %}
{% tabs %}
{% tab title="Godot 3.x" %}

```gdscript
Bridge.daily_rewards.claim_current_reward(funcref(self, "_on_claim_current_reward_completed"))

func _on_claim_current_reward_completed(claimed):
    if claimed:
        # grant the current reward
        pass
```

{% endtab %}

{% tab title="Godot 4.x" %}

```gdscript
Bridge.daily_rewards.claim_current_reward(Callable(self, "_on_claim_current_reward_completed"))

func _on_claim_current_reward_completed(claimed):
    if claimed:
        # grant the current reward
        pass
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="GameMaker" %}

```javascript
playgama_bridge_daily_rewards_claim_current_reward()

// callback via Async Social Event
if async_load[? "type"] == "playgama_bridge_daily_rewards_claim_current_reward_callback" {
    if async_load[? "success"] {
        // claimed - grant the current reward
    }
}
```

{% endtab %}

{% tab title="Defold" %}

```lua
local bridge = require("bridge.bridge")

function init(self)
    bridge.daily_rewards.claim_current_reward(
        function ()
            -- claimed, grant the current reward
        end,
        function ()
            -- nothing claimable or error
        end
    )
end
```

{% endtab %}

{% tab title="Cocos Creator" %}

```javascript
bridge.dailyRewards.claimCurrentReward()
    .then(() => {
        // grant the current reward
    })
```

{% endtab %}
{% endtabs %}
