# Stripe entitlements

> Active Stripe entitlements per tenant from the Stripe Sync Engine, feature_claims() for the access token hook, and has_entitlement() and tenant_ids_with_entitlement() for RLS.

- Category: Billing & commerce
- Module: `entitlements`
- Modes: `managed`
- Docs: https://bettersupabase.com/docs/blocks/entitlements
- Page: https://bettersupabase.com/blocks/entitlements

## Install

```bash
npx better-supabase add entitlements
```

The command also installs `updated-at`, `memberships`, `permissions`, `organizations`, `seeds`.

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Required by entitlements; add installs them too.
    "updated-at": {},
    memberships: {},
    permissions: {},
    organizations: {},
    seeds: {},
    // Modes: "managed". The default is "managed".
    entitlements: { mode: "managed" },
  },
});
```

## Client

The React hooks are the registry item `@better-supabase/use-entitlements` (`npx shadcn add @better-supabase/use-entitlements`). They return data and actions and render no UI. Source: https://github.com/ScaleDockHQ/better-supabase/blob/main/packages/registry/items/hooks/use-entitlements.ts

## Related blocks

Requires: [memberships](https://bettersupabase.com/blocks/memberships.md)

Works with: [billing](https://bettersupabase.com/blocks/billing.md), [organizations](https://bettersupabase.com/blocks/organizations.md)

## Recipes

- [Feature gate](https://bettersupabase.com/recipes/feature-gate.md): Content shown only when the active organization's plan includes a feature, read from the session's features claim and updated when the session refreshes.
