npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ingram-tech/stripe-pricing-table-react

v0.1.0

Published

React components and utilities for fetching and displaying Stripe pricing tables using private APIs

Readme

stripe-pricing-table-react

A React library for fetching and displaying Stripe pricing tables using Stripe's pricing table API. This library provides components and utilities to render custom pricing tables with data fetched directly from Stripe.

Important Notice

This library relies on Stripe's private API endpoints that are not officially documented or supported. These APIs:

  • May change or break without notice
  • Are not covered by Stripe's versioning policy
  • Could be rate-limited or blocked by Stripe
  • Should not be used in production without understanding the risks

It is strongly recommended to:

  1. Implement fallback mechanisms
  2. Cache pricing data to reduce API calls
  3. Have a backup pricing table configuration
  4. Monitor for API failures
  5. Consider using Stripe's official pricing table web component instead

Installation

npm install @ingram-tech/stripe-pricing-table-react

Features

  • 🎨 Customizable React components for pricing tables
  • 🔄 Real-time fetching from Stripe pricing tables
  • 📱 Responsive design with mobile support
  • 🎯 TypeScript support with full type definitions
  • 🧪 Comprehensive test coverage
  • 🎭 Custom card components for complete control
  • 💰 Multi-currency support
  • 🔄 Annual/monthly billing toggle

Quick Start

Using the PricingTable Component

import { PricingTable } from "stripe-pricing-table-react";

function App() {
	const handlePriceSelection = (priceId, item) => {
		console.log("Selected price:", priceId);
		// Redirect to checkout or handle selection
	};

	return (
		<PricingTable
			pricingTableId="prctbl_1234567890"
			publishableKey="pk_test_..."
			onSelectPrice={handlePriceSelection}
			annual={false}
		/>
	);
}

Using the Hook Directly

import { usePricingTable } from "stripe-pricing-table-react";

function CustomPricingTable() {
	const { pricingTable, loading, error } = usePricingTable({
		pricingTableId: "prctbl_1234567890",
		publishableKey: "pk_test_...",
	});

	if (loading) return <div>Loading...</div>;
	if (error) return <div>Error: {error}</div>;

	return (
		<div>
			{pricingTable?.pricing_table_items.map((item) => (
				<div key={item.price_id}>
					<h3>{item.name}</h3>
					<p>{item.amount ? `$${parseInt(item.amount) / 100}` : "Free"}</p>
				</div>
			))}
		</div>
	);
}

Custom Card Component

import { PricingTable } from "stripe-pricing-table-react";

const CustomCard = ({ item, isCurrentPrice, onSelect }) => (
	<div className="custom-pricing-card">
		<h3>{item.name}</h3>
		<p className="price">
			${parseInt(item.amount) / 100}/{item.recurring.interval}
		</p>
		<ul>
			{item.feature_list.map((feature, i) => (
				<li key={i}>{feature}</li>
			))}
		</ul>
		<button onClick={onSelect} disabled={isCurrentPrice}>
			{isCurrentPrice ? "Current Plan" : "Select"}
		</button>
	</div>
);

function App() {
	return (
		<PricingTable
			pricingTableId="prctbl_1234567890"
			publishableKey="pk_test_..."
			cardComponent={CustomCard}
		/>
	);
}

API Reference

Components

<PricingTable />

Main component for rendering a pricing table.

| Prop | Type | Default | Description | | ------------------ | --------------------------------------------------- | -------------- | --------------------------------- | | pricingTableId | string | required | Your Stripe pricing table ID | | publishableKey | string | required | Your Stripe publishable key | | annual | boolean | false | Show annual or monthly pricing | | currentPriceId | string | - | ID of the current plan | | onSelectPrice | (priceId: string, item: PricingTableItem) => void | - | Callback when a price is selected | | loadingComponent | ReactNode | Default loader | Custom loading component | | errorComponent | (error: string) => ReactNode | Default error | Custom error component | | cardComponent | React.FC<PricingCardProps> | Default card | Custom pricing card component | | className | string | - | CSS class for the container | | cardClassName | string | - | CSS class for the cards grid |

Hooks

usePricingTable

Hook for fetching pricing table data.

const { pricingTable, loading, error } = usePricingTable({
	pricingTableId: "prctbl_...",
	publishableKey: "pk_...",
});

Functions

fetchPricingTable

Low-level function to fetch pricing table data.

import { fetchPricingTable } from "stripe-pricing-table-react";

const pricingTable = await fetchPricingTable("prctbl_1234567890", "pk_test_...");

Error Handling

The library includes built-in error handling, but you should implement your own fallbacks:

function SafePricingTable() {
	const [fallbackToStatic, setFallbackToStatic] = useState(false);

	if (fallbackToStatic) {
		return <StaticPricingTable />; // Your fallback component
	}

	return (
		<PricingTable
			pricingTableId="prctbl_1234567890"
			publishableKey="pk_test_..."
			errorComponent={(error) => {
				console.error("Pricing table error:", error);
				setFallbackToStatic(true);
				return null;
			}}
		/>
	);
}

Alternatives

Consider these official alternatives:

  1. Stripe Pricing Table Element - Official web component
  2. Stripe Products API - Build your own with official APIs
  3. Stripe Checkout - Pre-built checkout experience