React SDK

Use PlandalfProvider and React hooks to present offers, identify customers, check gates, and render checkout experiences.

The React package wraps the browser SDK with a provider and hooks.

Provider

import { PlandalfProvider } from "@plandalf/react";

export function App() {
  return (
    <PlandalfProvider publicKey="pk_live_..." apiBase="https://acme.plandalf.com">
      <CheckoutButton />
    </PlandalfProvider>
  );
}

PlandalfProvider creates one SDK instance and passes it through React context.

Present an offer

import { usePresent } from "@plandalf/react";

export function CheckoutButton() {
  const { present, presenting } = usePresent();

  return (
    <button disabled={presenting} onClick={() => present("pro-plan", { frame: "modal" })}>
      Buy Pro
    </button>
  );
}

Access the SDK directly

import { useEffect } from "react";
import { usePlandalf } from "@plandalf/react";

export function IdentifyUser({ userJwt }: { userJwt: string }) {
  const sdk = usePlandalf();

  useEffect(() => {
    sdk.identify(userJwt);
    return () => sdk.reset();
  }, [sdk, userJwt]);

  return null;
}

Public React surface

Use these React exports for new integrations:

  • PlandalfProvider
  • usePlandalf
  • useGate
  • usePresent
  • Gate
  • useGateTrigger

For React work, prefer PlandalfProvider, hooks, and SDK flows.

Builder context

Move from SDK setup to the commerce surface.

SDK docs cover install, identity, gates, events, and React integration. The linked product surfaces show what the SDK is presenting or listening for.

The Numi API Keys settings page used to create organization API keys.
API keys and SDK configuration should be set before wiring checkout into an app.
The Numi Developer API documentation with sidebar navigation and SDK method reference.
SDK reference owns method details; builder resources explain the business path.
The Numi checkout requirements screen showing gate controls.
Gates decide when an offer or buying surface should be available.

Feature detail