Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Stripe.js

Official Stripe SDK for integrating payments and connect functionality in web and mobile apps.

SDKs for hosted servicesNPM

GitHubWebsiteAPI page

1. License

License from npm.

github.com/stripe/stripe-js

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What Stripe.js does

Stripe maintains the TypeScript types for its official server-side Node library, but the types follow only the latest Stripe API version, and the maintainers accept that a minor upgrade can surface new type errors.

Stripe.js popularity

62 / 100
Gid Score, #851 overall
20.9M
downloads a week, npm
756
GitHub stars
78
agent projects use it
Stripe.js: downloads per weeknpm, @stripe/stripe-js 20,851,826
Stripe.js: GitHub starsstripe/stripe-js 756

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How Stripe.js is used

  • Stripe.js is a dependency in 78 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (1.6% of the 4,867 JavaScript/TypeScript ones), #8 of 287 in sdks for hosted services.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 382; those are left out of every share on this page.
  • The most used alternative in our scan is Stripe (JavaScript) (164 projects).
  • Projects that use it most often also use Stripe (JavaScript) (85.9%), Lucide React (82.1%), clsx (73.1%).

By coding agent

40 projects, 1.6%
36 projects, 1.1%
25 projects, 0.8%
5 projects, 1.1%
5 projects, 1.8%

Often used with

In 85.9% of its projects
In 82.1% of its projects
In 73.1% of its projects
In 71.8% of its projects
In 67.9% of its projects
In 93.6% of its projects
In 67.9% of its projects
In 57.7% of its projects

Stripe.js in practice

Strengths

One automatic retry, with idempotency keys

As of v13 the client reattempts a failed request once if it is safe to retry. The README says idempotency keys are added where appropriate to prevent duplication. Setting <code>maxNetworkRetries</code> to <code>0</code> disables retries, but a request that fails with a closed connection (<code>ECONNRESET</code> or <code>EPIPE</code>) is still reattempted once. A higher number retries more times with exponential backoff.

Stripe-maintained types with open enums

As of 8.0.1, the README says Stripe maintains types for the latest API version. You import with a default import, not <code>* as Stripe</code> as with the DefinitelyTyped version. Open enum fields also accept other strings (<code>OtherString</code>), so values Stripe adds later still type-check.

Webhook signatures you can mock in tests

<code>webhooks.constructEvent()</code> validates the signature on events Stripe sends. <code>webhooks.generateTestHeaderString</code> builds a matching header, so a test can pass a mocked signed event through the same check.

Per-request timeout, retries and Connect account

<code>timeout</code> and <code>maxNetworkRetries</code> can be set on the client or overridden on a single call. A <code>stripeAccount</code> option adds a per-request <code>Stripe-Account</code> header to any method for use with Stripe Connect.

Watch out for

Server only

The library is configured with a secret key and is meant for server-side JavaScript. For collecting payment details in the browser, the README sends you to Stripe.js.

Types match only the latest API version

If your account uses an older API version, the types may not match the responses you get back. The README encourages upgrading your API version. If you cannot upgrade, it suggests a comment like <code>// @ts-ignore stripe-version-2019-10-17</code> wherever the types differ, removed again when you upgrade.

Minor upgrades can break your type check

Some API changes weaken the existing types but cannot break anything at runtime. The maintainers write that they "do NOT consider such changes to be breaking". A minor version bump can therefore bring TypeScript errors that need extra type guards.

Create a customer

import Stripe from 'stripe';
const stripeClient = new Stripe('sk_test_...');

const customer = await stripeClient.customers.create({
  email: 'customer@example.com',
});
console.log(customer.id);

More about Stripe.js

Packages around it
  • next: React framework
  • lucide-react: Icon set for React
  • react: UI library
  • clsx: Class name joiner
  • tailwind-merge: Tailwind class merger
  • tailwindcss: Utility-first CSS
More in SDKs for hosted services

Alternatives

Stripe.js This page

MITGid 6220.9M/wk

Stripe (JavaScript)

Official SDK for integrating Stripe payments and billing into applications.

MITGid 7235.8M/wk

Compare Stripe.js with another tool

Get started

Install it.

npm install @stripe/stripe-js

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## Stripe (stripe-node)
- Use `stripe` only in server-side code with the secret key; use Stripe.js to collect payment details in the browser.
- Import with `import Stripe from 'stripe'` (a default import, not `* as Stripe`) and instantiate with `new Stripe(...)`.
- If the file that creates the client can be imported while `STRIPE_SECRET_KEY` is absent (for instance during a build step), create the client lazily in a getter or pass a placeholder key.
- In webhook handlers, pass the raw request body to `webhooks.constructEvent()`, never a parsed JSON body; use `webhooks.generateTestHeaderString` to mock signed events in tests.
- Expandable fields are typed `string | Foo`; cast them (e.g. `as Stripe.Customer`) or use a helper that returns the `id`.
- Do not set `protocol: 'http'`; the README strongly discourages it, even in local testing, because credentials can be sent over an insecure channel.
- After a minor upgrade, fix new TypeScript errors with additional type guards.