---
title: Quickstart
description: Minimal path from SDK install to paywall, entitlements, and payment.
---

# Quickstart

Placeholders used everywhere in these docs:

| Placeholder | Meaning |
| --- | --- |
| `YOUR_API_URL` | Platform API base URL |
| `YOUR_APP_CODE` | Application code from admin |
| `YOUR_PUBLIC_KEY` | Public SDK key `rb_pub_…` |
| `YOUR_ACCESS_TOKEN` | End-user JWT from your auth provider |

## 1. Admin setup (once)

1. Create application → note `YOUR_APP_CODE`.
2. Add entitlements (example codes: `premium_feature`, `cloud_sync`).
3. Create plans (including optional `free`) and attach entitlements to **paid** plans.
4. Create paywall code `main` and attach plan prices.
5. Copy public key `YOUR_PUBLIC_KEY`.

## 2. TypeScript

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

const platform = new RaidBossPlatformClient({
  apiUrl: "YOUR_API_URL",
  applicationCode: "YOUR_APP_CODE",
  publicKey: "YOUR_PUBLIC_KEY",
  getAccessToken: async () => YOUR_ACCESS_TOKEN,
});

await platform.registerUser({ platform: "web" });
await platform.registerDevice({
  installation_id: "stable-uuid-on-device",
  platform: "web",
  app_version: "1.0.0",
});

const { data: paywall } = await platform.getPaywall("main");
const canPremium = await platform.hasEntitlement("premium_feature");
```

## 3. Flutter

```dart
final platform = RaidBossPlatformClient(
  apiUrl: 'YOUR_API_URL',
  applicationCode: 'YOUR_APP_CODE',
  publicKey: 'YOUR_PUBLIC_KEY',
  getAccessToken: () async => YOUR_ACCESS_TOKEN,
);

await platform.registerUser(platform: 'android');
await platform.registerDevice(
  installationId: installationId,
  platform: 'android',
  appVersion: '1.0.0',
);

final paywall = await platform.getPaywall(paywallCode: 'main');
final canPremium = await platform.hasEntitlement('premium_feature');
```

## 4. Purchase (paid only)

```ts
const price = paywall.paywall_items?.[0]?.plan_prices;
if (price && !RaidBossPlatformClient.isFreePrice(price)) {
  const { data } = await platform.createPayment({
    plan_price_id: String(price.id),
    return_url: "https://your.app/pay/return",
  });
  // open data.confirmation_url
}
```

Never call `createPayment` for free prices (`is_free` / `works_offline` / `requires_purchase: false`).

## 5. Feature gating rule

```text
if feature is free-local → allow (even offline)
else if online → sync entitlements, update cache, check code
else → check cached entitlements + expires_at
```

Next: [Entitlements](/concepts/entitlements) · [Payments](/guides/payments) · [Offline](/concepts/free-offline)
