---
title: TypeScript / Web SDK
description: Package @raidboss/platform-sdk for web and React Native.
---

# TypeScript / Web — `@raidboss/platform-sdk`

## Install from Git (recommended for product apps)

```bash
npm install github:ivanbalandin/RaidBossPlatform#main:packages/platform-sdk
```

```json
{
  "dependencies": {
    "@raidboss/platform-sdk": "github:ivanbalandin/RaidBossPlatform#main:packages/platform-sdk"
  }
}
```

Pin a release with a tag or commit SHA:

```json
"@raidboss/platform-sdk": "github:ivanbalandin/RaidBossPlatform#sdk-ts-v0.1.0:packages/platform-sdk"
```

Private repo (SSH):

```json
"@raidboss/platform-sdk": "git+ssh://git@github.com:ivanbalandin/RaidBossPlatform.git#main:packages/platform-sdk"
```

`prepare` builds `dist/` via `tsc` when the full package is present (git/path install).  
Docker monorepo deps stages (package.json only) skip the build.

## Install from path (local monorepo)

```json
{
  "dependencies": {
    "@raidboss/platform-sdk": "file:../RaidBossPlatform/packages/platform-sdk"
  }
}
```

```ts
import {
  RaidBossPlatformClient,
  createRaidBossClient,
  RaidBossPlatformError,
} from "@raidboss/platform-sdk";
```

## Construct

```ts
const platform = new RaidBossPlatformClient({
  apiUrl: "YOUR_API_URL",
  applicationCode: "YOUR_APP_CODE",
  publicKey: "YOUR_PUBLIC_KEY",
  getAccessToken: async () => tokenOrNull,
  // applicationId?: string
  // fetch?: typeof fetch
});
```

## Methods

| Method | Auth | Public key | Notes |
| --- | --- | --- | --- |
| `getPaywall(code?)` | no | recommended | Default paywall `main` |
| `registerUser(...)` | yes | — | Call after login/signup |
| `registerDevice(...)` | yes | — | Stable `installation_id` |
| `getMyEntitlements()` | yes | — | Snapshot + `codes` |
| `hasEntitlement(code)` | yes | — | Convenience |
| `hasAnyEntitlement(codes)` | yes | — | Convenience |
| `createPayment({ plan_price_id, return_url })` | yes | required | Paid only |
| `checkout(planPriceId, returnUrl)` | yes | required | Alias helper |
| `activateLicenseKey({ key, installation_id? })` | yes | — | Grants plan rights |
| `listDevices()` / `revokeDevice(id)` | yes | — | Device management |
| `getConfig(...)` | no | — | Remote config map |
| `getFeatures(...)` | yes | — | Feature flags |
| `trackEvent` / `trackEvents` | yes | — | Analytics |
| `createSupportTicket` | yes | required | Helpdesk ticket |
| `uploadSupportAttachment` | yes | required | Screenshot / video / log |
| `listMySupportTickets` / `getSupportTicket` / `replyToSupportTicket` | yes | — | My tickets |
| `isFreePrice(price)` static | — | — | Detect free offer |

## Free price helper

```ts
if (RaidBossPlatformClient.isFreePrice(price)) {
  // do not createPayment — local free tier
}
```

## Errors

Failed HTTP calls throw `RaidBossPlatformError` with `status` and `body`.

Free checkout attempt returns API error `free_plan_offline`.

## Example (auth provider)

```ts
const platform = createRaidBossClient({
  apiUrl: "YOUR_API_URL",
  applicationCode: "YOUR_APP_CODE",
  publicKey: "YOUR_PUBLIC_KEY",
  getAccessToken: async () => session?.access_token ?? null,
});
```
