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)
- Create application → note
YOUR_APP_CODE. - Add entitlements (example codes:
premium_feature,cloud_sync). - Create plans (including optional
free) and attach entitlements to paid plans. - Create paywall code
mainand attach plan prices. - Copy public key
YOUR_PUBLIC_KEY.
2. TypeScript
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
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)
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
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 · Payments · Offline