# Achievements

**Support**

Use this to determine if you can implement achievements for your game on the current platform.

```
bridge.achievements.isSupported
```

Check if getting list of achievements is supported.

```
bridge.achievements.isGetListSupported
```

Check if built-in popup is supported.

```
bridge.payments.isNativePopupSupported
```

**Unlock achievement**

Unlocks achievement for a player.

```javascript
let options = { }

switch (bridge.platform.id) {
    case 'y8':
        options = {
            achievement: 'ACHIEVEMENT_NAME',
            achievementkey: 'ACHIEVEMENT_KEY'
        }
        break
    case 'lagged':
        options = {
            achievement: 'ACHIEVEMENT_ID'
        }
        break
}

bridge.achievements.unlock(options)
    .then((result) => {
        // success
    })
    .catch(error => {
        // error
    })
```

**Get List**

Returns the achievement list in JSON

<pre class="language-javascript"><code class="lang-javascript"><strong>let options = { }
</strong>
bridge.achievements.getList(options)
    .then(list => {
        // success
        switch (bridge.platform.id) {
            case 'y8':
                list.forEach(list => {
                    console.log('achievementid: ' + list.achievementid)
                    console.log('achievement: ' + list.achievement)
                    console.log('description: ' + list.description)
                    console.log('achievementkey: ' + list.achievementkey)
                    console.log('icon: ' + list.icon)
                    console.log('playerid: ' + list.playerid)
                    console.log('playername: ' + list.playername)
                })
                break
        }
    })
    .catch(error => {
        // error
    })
</code></pre>

**Show Native Popup**

Some platforms support built-in achievement list which is shown in overlay

<pre class="language-javascript"><code class="lang-javascript"><strong>let options = { }
</strong>
bridge.achievements.showNativePopup(options)
    .then(() => {
        // success
    })
    .catch(error => {
        // error
    })
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.playgama.com/playgama/sdk/engines/core-plain-js/achievements.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
