Skip to main content
Use the live playground to preview Customer Portal and Pricing Table before integrating the SDK into your application: React SDK Playground.

Installation


Setup

Initialize once with your client key (from the Metrifox dashboard) before rendering any SDK components.
Works with React, Next.js, and other setups on React 18+. Environment variable names may vary by framework; use the public prefix your bundler expects so the key is available in the browser.

Widgets

CustomerPortal

Renders a customer dashboard: plans, subscriptions, billing, credits, and related sections.
Optional theme prop: pass a CustomerPortalTheme partial to override or extend the global theme from metrifoxInit for this mount only (merged with defaults and global config).

Section configuration

Built-in section keys

Each section is wrapped in <section id="..."> for hash links (for example https://yourapp.com/billing#billing-history).

PricingTable

Renders subscription plans and one-time purchases for a product.

Props

If both plansOnly and singlePurchasesOnly are false or omitted, both plans and single purchases are shown.Embedded checkout only works if checkoutSettings.signup_redirect_url is not set or customerKey is provided.

Styling

Import global SDK styles once (for example in src/main.tsx, app/layout.tsx, or _app.tsx):
This stylesheet is required for correct layout and components.

Theme configuration

Theming is driven by a single object passed to metrifoxInit:
Every theme field is optional. Omitted keys fall back to SDK defaults. <CustomerPortal /> and <PricingTable /> may each take an optional theme prop to layer overrides for that instance only (deep-merged with global config and defaults).
Values accept any valid CSS value: hex, rgb(), hsl(), named colors, lengths (px, rem, %), and font-family strings. The skeletons below use "" as placeholders — replace only the keys you want to override.

Customer Portal theme (CustomerPortalTheme)

Every field is optional. Groups and roles: Full CustomerPortalTheme reference — all string fields shown as "". Omit any group or key you do not need to customize.

Font customization

Set customerPortal.general.fontFamily or pricingTable.general.fontFamily to any CSS font-family string. Your app must load the font (Google Fonts, @font-face, etc.) before or as the SDK mounts to avoid FOUT.

Pricing Table theme (PricingTableTheme)

Plan-related tokens are nested under plans (for example plans.planCards, plans.planToggle). When Pricing Table is embedded in Customer Portal, plan styling follows theme.customerPortal.plans so portal and table stay consistent. Every field is optional. Groups and roles: Full PricingTableTheme reference — all string fields shown as "". Omit any group or key you do not need to customize.

Applying your theme

You can set theme in two places. Both accept partial objects, only include the keys you want to change.

Global (all widgets)

Pass theme to metrifoxInit once at app startup. Every <CustomerPortal /> and <PricingTable /> inherits it:

Per component (single instance)

Pass theme on an individual widget to override the global config for that mount only:

Changelog and support

Release history and breaking-change notes: SDK changelog.
Package README and issue trackers live on the public npm scope @metrifox/react-sdk.
Broader product docs: docs.metrifox.com.