{
 "kind": "tool",
 "slug": "stripe-npm",
 "path": "tools/stripe-npm/",
 "name": "Stripe.js",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "SDKs for hosted services",
   "tools/service-sdks/"
  ]
 ],
 "lead": "Official Stripe SDK for integrating payments and connect functionality in web and mobile apps.",
 "chips": [
  {
   "label": "SDKs for hosted services",
   "path": "tools/service-sdks/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install @stripe/stripe-js"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/stripe/stripe-js"
  },
  {
   "label": "Website",
   "href": "https://stripe.com/docs/js"
  },
  {
   "label": "API page",
   "path": "apis/stripe-agent-toolkit/"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/stripe/stripe-js"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 20, 2026",
   "note": "Latest GitHub release Nov 12, 2026. ",
   "src": "https://github.com/stripe/stripe-js"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "78 projects",
   "status": "info",
   "sub": "#8 of 287 in its category",
   "note": "Dependency in 78 public GitHub projects set up for AI coding agents that we scanned (1.2%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://stripe.com/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Stripe.js does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Stripe.js popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "62",
       "of": "/ 100",
       "l": "Gid Score, #851 overall"
      },
      {
       "n": "20.9M",
       "l": "downloads a week, npm"
      },
      {
       "n": "756",
       "l": "GitHub stars"
      },
      {
       "n": "78",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How Stripe.js is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "40 projects, 1.6%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "36 projects, 1.1%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "25 projects, 0.8%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "5 projects, 1.1%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "5 projects, 1.8%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 85.9% of its projects",
       "v": "Stripe (JavaScript)",
       "path": "tools/stripe-node/"
      },
      {
       "l": "In 82.1% of its projects",
       "v": "Lucide React",
       "path": "tools/lucide-react/"
      },
      {
       "l": "In 73.1% of its projects",
       "v": "clsx",
       "path": "tools/clsx/"
      },
      {
       "l": "In 71.8% of its projects",
       "v": "Tailwind Merge",
       "path": "tools/tailwind-merge/"
      },
      {
       "l": "In 67.9% of its projects",
       "v": "Class Variance Authority",
       "path": "tools/class-variance-authority/"
      },
      {
       "l": "In 93.6% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 67.9% of its projects",
       "v": "Next.js",
       "path": "tools/next/"
      },
      {
       "l": "In 57.7% of its projects",
       "v": "Supabase JS",
       "path": "tools/supabase-supabase-js/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "Stripe.js in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "One automatic retry, with idempotency keys",
       "v": "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."
      },
      {
       "l": "Stripe-maintained types with open enums",
       "v": "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."
      },
      {
       "l": "Webhook signatures you can mock in tests",
       "v": "<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."
      },
      {
       "l": "Per-request timeout, retries and Connect account",
       "v": "<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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Server only",
       "v": "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."
      },
      {
       "l": "Types match only the latest API version",
       "v": "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."
      },
      {
       "l": "Minor upgrades can break your type check",
       "v": "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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Create a customer"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Js",
       "code": "import Stripe from 'stripe';\nconst stripeClient = new Stripe('sk_test_...');\n\nconst customer = await stripeClient.customers.create({\n  email: 'customer@example.com',\n});\nconsole.log(customer.id);"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about Stripe.js",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Packages around it",
       "items": [
        "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"
       ]
      },
      {
       "title": "More in SDKs for hosted services",
       "path": "tools/service-sdks/",
       "items": [
        {
         "text": "Supabase JS",
         "path": "tools/supabase-supabase-js/"
        },
        {
         "text": "Supabase SSR",
         "path": "tools/supabase-ssr/"
        },
        {
         "text": "AWS SDK for JavaScript (S3)",
         "path": "tools/aws-sdk-client-s3/"
        },
        {
         "text": "Resend",
         "path": "tools/resend-npm/"
        },
        {
         "text": "Supabase CLI",
         "path": "tools/supabase-npm/"
        },
        {
         "text": "Firebase",
         "path": "tools/firebase-node/"
        },
        {
         "text": "Google APIs Client Library",
         "path": "tools/googleapis/"
        },
        {
         "text": "google-auth",
         "path": "tools/google-auth/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Stripe.js",
       "me": true,
       "facts": [
        "MIT",
        "Gid 62",
        "20.9M/wk"
       ]
      },
      {
       "name": "Stripe (JavaScript)",
       "why": "Official SDK for integrating Stripe payments and billing into applications.",
       "path": "tools/stripe-node/",
       "facts": [
        "MIT",
        "Gid 72",
        "35.8M/wk"
       ]
      }
     ],
     "more": "Compare Stripe.js with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install @stripe/stripe-js"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## Stripe (stripe-node)\n- Use `stripe` only in server-side code with the secret key; use Stripe.js to collect payment details in the browser.\n- Import with `import Stripe from 'stripe'` (a default import, not `* as Stripe`) and instantiate with `new Stripe(...)`.\n- 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.\n- 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.\n- Expandable fields are typed `string | Foo`; cast them (e.g. `as Stripe.Customer`) or use a helper that returns the `id`.\n- Do not set `protocol: 'http'`; the README strongly discourages it, even in local testing, because credentials can be sent over an insecure channel.\n- After a minor upgrade, fix new TypeScript errors with additional type guards.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm @stripe/stripe-js"
  ],
  [
   "Category",
   "SDKs for hosted services"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Latest version",
   "v23.0.0, October 1, 2026"
  ],
  [
   "On GitHub since",
   "September 2011"
  ],
  [
   "Gid Score",
   "62.2"
  ],
  [
   "Rank in category",
   "#8 of 287"
  ],
  [
   "GitHub",
   "stripe/stripe-js"
  ],
  [
   "Last change",
   "Nov 20, 2026"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/stripe.png"
}