Skip to content

PlanSignal - Examples

PlanSignal emits plan, billing, and entitlement facts at read time. Your application interprets those facts and executes outcomes elsewhere.

Use it when a feature depends on subscription status, billing state, entitlements, or account tier, and you want those facts explicit before the application decides.

Example

// Application-owned outcome example.
// PlanSignal does not grant access or block requests.

// Read-time plan lookup.
const billing = await planSignal.state({
  subject: userId,
  scope: "account",
});

// Example shape:
// {
//   plan: "free" | "standard" | "commercial",
//   status: "active" | "past_due" | "canceled",
//   entitlements: ["export", "team_access"]
// }

if (billing.status !== "active") {
  return rejectFeatureAccess("Account is not active");
}

if (!billing.entitlements.includes("export")) {
  return rejectFeatureAccess("Export entitlement not present");
}

return grantExportAccess();

Plan state is not authorization. PlanSignal emits facts. Your application owns access control, degraded modes, and user-facing behavior.

Related links

<- Examples|Products