
Security News
Rolldown Pulls Rust React Compiler Integration After Binary Size Increase
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.
react-stripe-toolkit
Advanced tools
Lightweight TypeScript hooks and components that make Stripe Checkout and other Stripe flows effortless in React.
A lightweight React library that simplifies integrating Stripe Checkout into your application. This toolkit provides a custom hook, useStripeCheckout, that manages the loading state, errors, and redirection flow for you, making your Stripe integration clean and straightforward.
npm install react-stripe-toolkit
or
yarn add react-stripe-toolkit
| Hook | Description |
|---|---|
useStripeCheckout | A hook to handle the entire Stripe Checkout redirection flow, including session creation and error handling. |
useStripeSubscription | A hook to handle the Stripe Checkout flow for creating recurring subscriptions. |
useStripeInvoices | A hook to fetch a list of invoices for a given Stripe Customer ID. |
useStripeWebhook | A hook to process and handle Stripe webhook events with type safety. |
To run the included example application on your machine:
Clone the repository:
git clone https://github.com/vlad-grigoryan/react-stripe-toolkit.git
cd react-stripe-toolkit
Install root dependencies:
npm install
Set up the example:
Navigate to the example directory and create a .env file.
cd example
touch .env
Add your Stripe keys to .env:
You'll need your Stripe publishable key and secret key.
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_SECRET_KEY=sk_test_...
Install example dependencies and run:
npm install
npm run dev
The demo will be available at http://localhost:5173.
react-stripe-toolkit?The goal of this toolkit is to abstract away the boilerplate and complexity of setting up Stripe Checkout in a React application. By using the useStripeCheckout hook, you get:
MIT
npm install react-stripe-toolkit @stripe/stripe-js
Requires React 17+, TypeScript optional.
import { useStripeCheckout } from 'react-stripe-toolkit';
export function PayButton() {
const { redirect, loading, error } = useStripeCheckout({
publishableKey: import.meta.env.VITE_STRIPE_PUBLISHABLE_KEY,
});
return (
<button
disabled={loading}
onClick={() => redirect(undefined, { priceId: '<your_price_id>' })}
>
{loading ? 'Redirecting…' : 'Pay with Stripe'}
</button>
);
}
redirect() accepts either an existing sessionId or payload for your backend to create one. See useStripeCheckout for full API.
A complete Vite demo lives in example/.
git clone https://github.com/vlad-grigoryan/react-stripe-toolkit.git
cd react-stripe-toolkit
# create env file with your keys
cp example/.env.example example/.env
# edit example/.env
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_xxx
STRIPE_SECRET_KEY=sk_test_xxx
npm install # installs root + example deps
npm --prefix example run dev # opens http://localhost:5173
The exact same demo is deployed on Netlify: https://coruscating-gumption-4ce6a7.netlify.app/.
VITE_STRIPE_PUBLISHABLE_KEY and STRIPE_SECRET_KEY.netlify.toml, builds example/, and deploys.Pull requests and issues are welcome! Please open an issue first to discuss major changes.
MIT © 2025 Vlad Grigoryan
FAQs
Lightweight TypeScript hooks and components that make Stripe Checkout and other Stripe flows effortless in React.
We found that react-stripe-toolkit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.

Security News
The Fable shutdown shows how quickly model access can become a business continuity risk for AI-dependent engineering teams.