# Setup

JS Core is the heart of the SDK, containing all the core logic. Plugins for game engines (Unity, Godot, Construct) are merely overlays on top of JS Core. JS Core can be used directly without any plugins in web engines (PlayCanvas, Phaser, LayaAir, etc.).

### <img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2F9BooaofCI33U9Np5oeif%2FFrame%203%20(1).png?alt=media&#x26;token=0750b56a-a069-4759-bda9-29951f06cd30" alt="" data-size="line"> Integration <a href="#integration" id="integration"></a>

Add the script from CDN:

```html
<html>
    <head>
        <script src="https://bridge.playgama.com/v1/stable/playgama-bridge.js"></script>
    </head>
    <body>...</body>
</html>
```

When the game is launched on supported platforms, the SDK will automatically load the necessary platform scripts. On unsupported platforms, no errors will occur; a mock platform will be used, and any request will return `false`, `reject`, etc.

#### Available routes

<table><thead><tr><th width="376.0546875">URL</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>https://bridge.playgama.com/v1/stable/playgama-bridge.js
</code></pre><p>  <mark style="background-color:$primary;">recommended</mark>  </p></td><td>Contains the latest version for major v1.x.x. There will be no backward-incompatible changes.</td></tr><tr><td><pre><code>https://bridge.playgama.com/latest/playgama-bridge.js
</code></pre></td><td>Contains the latest version of the SDK. There may be backward-incompatible changes.</td></tr><tr><td><pre><code>https://bridge.playgama.com/v1.25.0/playgama-bridge.js
</code></pre><pre><code>https://bridge.playgama.com/v1.26.0/playgama-bridge.js
</code></pre><pre><code>etc.
</code></pre></td><td>Contains the SDK of a specific version.</td></tr></tbody></table>

### <img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2F9BooaofCI33U9Np5oeif%2FFrame%203%20(1).png?alt=media&#x26;token=0750b56a-a069-4759-bda9-29951f06cd30" alt="" data-size="line"> Config <a href="#config" id="config"></a>

Download the `playgama-bridge-config.json` file from the [GitHub release page](https://github.com/playgama/bridge/releases), and add it to your project. There you can set up various identifiers and in-game purchases.

You can see an explanation of the file structure here: [playgama-bridge-config](https://wiki.playgama.com/playgama/sdk/playgama-bridge-config "mention").

### <img src="https://1088849411-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5ukgSPDBOdbQp4FYtbz1%2Fuploads%2F9BooaofCI33U9Np5oeif%2FFrame%203%20(1).png?alt=media&#x26;token=0750b56a-a069-4759-bda9-29951f06cd30" alt="" data-size="line"> Initialization <a href="#initialization" id="initialization"></a>

Before using the SDK, you need to call the initialization method and wait for it to complete.

```javascript
bridge.initialize()
    .then(() => {
        // initialization was successful, SDK can be used
    })
    .catch(error => {
        // error, something went wrong
    })
```
