Recur Docs

Components

Drop-in React components for subscribe, sign-in, manage, and re-approve flows.

Coming Soon. @recur/react is currently in development. The components documented below represent the planned API. Use @recur/sdk directly for now.

Components

All components are exported from @recur/react and require a <RecurProvider> ancestor. They use sensible inline styles out of the box; import the optional stylesheet for the branded look.

import "@recur/react/styles.css"; // optional branded theme

<RecurProvider>

Mount once near the root of your app.

PropTypeRequiredDescription
apiBaseUrlstringyesYour Recur API origin (e.g. https://api.recur.foundation)
cluster"devnet" | "mainnet-beta"yesPicks default RPC, program ID, USDC mint
rpcUrlstringnoOverride the cluster's default RPC
walletsWalletAdapter[]noProvide your own @solana/wallet-adapter-react adapters; auto-detected if omitted
disableAuthbooleannoSkip the JWT sign-in helper if you handle auth yourself
disableWalletbooleannoBring your own wallet provider above <RecurProvider>

<SubscribeButton>

One-click subscribe. Connects wallet → signs in → delegates USDC → registers with Recur API.

<SubscribeButton appId="app_xxx" planId="plan_xxx">
  Subscribe — $9.99/month
</SubscribeButton>
PropTypeDescription
appIdstringThe merchant app the plan belongs to
planIdstringThe plan to subscribe to
delegationCycles?numberCycles of USDC to pre-approve. Default 12
onSuccess?(s: SubscriptionInfo) => voidCalled after registration
onError?(e: RecurError) => voidCalled on any failure
childrenReactNodeButton label

<SignInButton>

Just the JWT step (nonce → sign message → verify) without a transaction. Useful if you want to show subscription history before forcing a subscribe.

<ConnectButton>

A minimal wallet-connect button if <RecurProvider> is detecting wallets. Exposes connection state via useRecur().

<ManageSubscriptionsCard>

Renders the connected wallet's active subscriptions with cancel and re-approve actions. Embeds <ReapproveModal> for delegation top-ups.

PropTypeDescription
cancelMode?"request" | "instant"Default "request" (preserves prepaid time). "instant" calls subscriber_cancel and forfeits the remainder of the period

<ReapproveModal>

Standalone modal for re-approving USDC delegation when an existing subscription's delegation is exhausted or revoked. Already embedded in <ManageSubscriptionsCard>; expose it directly only if you build a custom management UI.

<ErrorMessage>

role="alert" wrapper that renders a RecurError with a sensible default message. Matches the styling of the other components.

Styling

Every component renders with inline-style fallbacks so it looks reasonable without any CSS. Import @recur/react/styles.css for the full branded look (focus rings, hover, dark-mode media query). All colors use recur-* CSS variables you can override:

:root {
  --recur-primary: #...;
  --recur-bg: #...;
  --recur-text: #...;
}

On this page