Buildspace
Billing

Entitlements

Gate paid features from Buildspace-synced billing state.

Your app should make access decisions from Buildspace entitlements or subscription state.

Signed-in browser user

const entitlements = await bs.billing.getEntitlements();

if (!entitlements.active) {
  await bs.billing.redirectToCheckout({
    lookupKey: "pro_monthly",
    successUrl: `${window.location.origin}/billing/success`,
    cancelUrl: window.location.href,
  });
}

Server-side gating

const entitlements = await bs.billing.getEntitlements({
  appUserId: "customer_123",
});

if (!entitlements.active) {
  throw new Error("Upgrade required");
}

Important behavior

  • getSubscription() tells you the current Stripe subscription state.
  • getEntitlements() is the better high-level check for feature access.
  • Checkout success pages are not entitlement checks. Wait for synced billing state.

On this page