
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
@ingram-tech/stripe-pricing-table-react
Advanced tools
React components and utilities for fetching and displaying Stripe pricing tables using private APIs
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.
This library relies on Stripe's private API endpoints that are not officially documented or supported. These APIs:
It is strongly recommended to:
npm install @ingram-tech/stripe-pricing-table-react
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}
/>
);
}
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>
);
}
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}
/>
);
}
<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 |
usePricingTable
Hook for fetching pricing table data.
const { pricingTable, loading, error } = usePricingTable({
pricingTableId: "prctbl_...",
publishableKey: "pk_...",
});
fetchPricingTable
Low-level function to fetch pricing table data.
import { fetchPricingTable } from "stripe-pricing-table-react";
const pricingTable = await fetchPricingTable("prctbl_1234567890", "pk_test_...");
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;
}}
/>
);
}
Consider these official alternatives:
FAQs
React components and utilities for fetching and displaying Stripe pricing tables using private APIs
The npm package @ingram-tech/stripe-pricing-table-react receives a total of 12 weekly downloads. As such, @ingram-tech/stripe-pricing-table-react popularity was classified as not popular.
We found that @ingram-tech/stripe-pricing-table-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.