Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.priceos.com/llms.txt

Use this file to discover all available pages before exploring further.

Be sure to check out Linking Stripe Customers to learn more about how to identify Stripe customers with your own internal customer ID.

Evaluating access for a single feature

import { useFeatureAccess } from "priceos/react";
import type { MyFeatures } from "./priceos.types";

export function PrioritySupportButton() {
  const { hasAccess, isLoading } = useFeatureAccess<MyFeatures>("priority_support");

  const onClick = () => {
    if (!hasAccess){
      // Customer does not have access
    }

    // Allow action
  }

  if (isLoading) return <div>Loading...</div>;

  return (
    <button onClick={onClick}>
      Contact support
    </button>
  );
}

Evaluate access for all features

Boolean features are simple on/off checks using hasAccess.
import { useFeatureAccess } from "priceos/react";
import type { MyFeatures } from "./priceos.types";

export function PrioritySupportButton() {
  const { featureAccess, isLoading } = useFeatureAccess<MyFeatures>();

  const onClick = () => {
    const hasAccess = featureAccess.priority_support.hasAccess;

    if (hasAccess){
      // Allow action
    }
 
  }

  if (isLoading) return <div>Loading...</div>;

  return <button onClick={onClick}>Contact support</button>;
}