Use the live playground to preview Customer Portal and Pricing Table before integrating the SDK into your application: React SDK Playground.Documentation Index
Fetch the complete documentation index at: https://docs.metrifox.com/llms.txt
Use this file to discover all available pages before exploring further.
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.
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
| Property | Type | Description |
|---|---|---|
key | SectionKey | Section identifier (see table below) |
hidden | boolean | When true, the section is not shown |
component | React.ComponentType | Replace the default section UI |
props | Record<string, unknown> | Props passed to custom or default section |
Built-in section keys
| Key | Description |
|---|---|
upcomingInvoice | Next invoice details |
subscription | Active subscription overview |
creditBalance | Wallet / credit balance |
entitlementUsage | Usage meters |
paymentOverview | Payment methods and summary |
billingHistory | Past invoices / transactions |
plan | Current plan |
Section anchors (deep links)
Each section is wrapped in<section id="..."> for hash links (for example https://yourapp.com/billing#billing-history).
| Anchor ID | Section key |
|---|---|
#upcoming-invoice | upcomingInvoice |
#subscription | subscription |
#credit-balance | creditBalance |
#entitlement-usage | entitlementUsage |
#payment-overview | paymentOverview |
#billing-history | billingHistory |
#plan | plan |
PricingTable
Renders subscription plans and one-time purchases for a product.
Props
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
checkoutUsername | string | Yes | — | Checkout username from Settings → Checkout |
productKey | string | Yes | — | Product identifier from the product page |
plansOnly | boolean | No | false | Only subscription plans |
singlePurchasesOnly | boolean | No | false | Only one-time purchases |
showTabHeader | boolean | No | true | Tab header for plans vs single purchases |
theme | PricingTableTheme | No | — | Per-instance theme override (merged with global theme.pricingTable) |
If both
plansOnly and singlePurchasesOnly are false or omitted, both plans and single purchases are shown.Styling
Import global SDK styles once (for example insrc/main.tsx, app/layout.tsx, or _app.tsx):
Theme configuration (supported shape)
Theming is driven by a single object passed tometrifoxInit:
<CustomerPortal /> and <PricingTable /> may each take an optional theme prop to layer overrides for that instance only.
Not supported on v2.0.0+: passing pricingTableTheme at the root of metrifoxInit, or the legacy flat customer portal / pricing table theme shapes. Those APIs are not honored in 2.x.
Customer Portal theme (CustomerPortalTheme)
Grouped by UI area; every field is optional.
| Group | Role |
|---|---|
general | Page: link color, background, radius, font, container padding |
tabs | Tab bar: backgrounds, borders, active / inactive text |
sections | Section cards: surfaces, typography, usage bars, empty states |
buttons | Primary / secondary buttons |
lineItems | Subscription line rows |
tables | Data tables (e.g. billing history) |
modals | Modal shell and actions |
plans | Plan cards inside the portal: currentPlanCard, planCards, planFeatures, planButton, planToggle, planTags |
Font customization
SetcustomerPortal.general.fontFamily (or pricing-table-related tokens as documented in types) 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 live under plans (for example plans.planCards, plans.planToggle). Top-level plan keys are not supported.
| Key | Purpose |
|---|---|
plans | All plan UI: currentPlanCard, planCards, planFeatures, planButton, planToggle, planTags |
tabs | Plans vs single-purchase tabs: inactiveText, activeText, indicator, borderColor |
checkoutBar | Sticky checkout bar colors |
theme.customerPortal.plans so portal and table stay consistent.
Full init example
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.

