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

stripe-api-test-simulator

v1.0.4

Published

A Node.js library to simulate Stripe API requests and responses for testing purposes. Useful for integration testing, development, and CI/CD pipelines without making real Stripe API calls.

Readme

Stripe API Test Simulator

A Node.js library to simulate Stripe API requests and responses for testing purposes. Useful for integration testing, development, and CI/CD pipelines without making real Stripe API calls.

Features

  • Simulate Stripe API endpoints and responses
  • Built-in utilities for common Stripe objects
  • Easy integration with Playwright and other test frameworks

Installation

npm install stripe-api-test-simulator@latest

🔑 Setup Add your Stripe test API key to .env:

.env

STRIPE_API_KEY=sk_test...your_key_here... #just make sure that we are using the exact same key name

Load it in your code (e.g., with dotenv): require("dotenv").config();

Usage

import { runSimulation, runSimulationForExistingSubscription } from "stripe-api-test-simulator";

// Simulate a subscription
await runSimulation("price_*****", 31, 4);

Here’s what it does:
"price_*****": This is a Stripe price ID, representing the product or subscription price you want to simulate.
31: Likely represents the number of days to simulate (e.g., simulating a monthly subscription for 31 days).
4: Probably the number of billing cycles or periods to simulate (e.g., simulate 4 months).

Functions

  1. runSimulation(priceId, subscriptionCycleDays, simulationCount) Purpose: Simulates a newly created subscription on Stripe.

When to use:

  • Testing subscription lifecycles from scratch (new customers, new subscriptions).
  • Useful for validating how your system handles initial setup and billing cycles.
  1. runSimulationForExistingSubscription(priceId, subscriptionId, subscriptionCycleDays, simulationCount) Purpose: Simulates events for an already existing subscription in Stripe.

When to use:

Testing how your system handles renewals, payments, and other recurring events.

Important Requirement:

  • The subscription must already have a test clock attached.
  • ⚠️ Stripe does not allow attaching a test clock to an existing customer or subscription later.
  • Make sure the test clock integration is set up at the time of subscription creation.

👉 Summary:

  • Use runSimulation for new subscriptions.
  • Use runSimulationForExistingSubscription for renewals and recurring events, but only if a test clock was attached during creation.

Contributing

Pull requests and issues are welcome! Please open an issue to discuss your ideas.