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

checkout-stripe

v1.0.1

Published

Stripe Checkout Extension

Readme

Stripe Checkout Extension

This extension provides a simple integration with Stripe Checkout for processing payments.

Setup

  1. Install dependencies:
npm install
  1. Create a .env file in the root directory with the following variables:
STRIPE_SECRET_KEY=your_stripe_secret_key
PUBLIC_URL=your_frontend_url  # e.g., http://your-domain.com

http://3.107.204.138:5003/stripe-checkout1/create-checkout-session

API Endpoint

Create Checkout Session

Endpoint: POST /create-checkout-session

Creates a Stripe checkout session for processing payments.

Request Body:

{
  "amount": 9.99,                    // Required: Price in USD
  "orderNumber": "123456789",        // Required: Unique order identifier
  "customerEmail": "[email protected]", // Optional: Customer's email
  "productDetails": {                // Required: Product information
    "name": "Product Name",          // Required: Name of the product
    "quantity": 1,                   // Required: Quantity to purchase
    "description": "Description",    // Optional: Product description
    "images": [                      // Optional: Product images
      "https://example.com/image1.jpg"
    ]
  }
}

Success Response:

{
  "checkout_url": "https://checkout.stripe.com/...",
  "session_id": "cs_test_..."
}

Error Response:

{
  "error": "Error message here"
}

Success and Cancel URLs

The extension will redirect to:

  • Success: ${PUBLIC_URL}/payment-success?session_id={CHECKOUT_SESSION_ID}
  • Cancel: ${PUBLIC_URL}/payment-cancel

Make sure these routes are handled in your frontend application.

Error Handling

The extension includes validation for:

  • Required environment variables
  • Required request body fields
  • Product details validation
  • Stripe API errors

Example Usage

// Example using fetch
const response = await fetch('/create-checkout-session', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    amount: 29.99,
    orderNumber: "ORD123456",
    customerEmail: "[email protected]",
    productDetails: {
      name: "Premium Package",
      quantity: 1,
      description: "Complete premium package with all features",
      images: ["https://example.com/product.jpg"]
    }
  })
});

const { checkout_url } = await response.json();
window.location.href = checkout_url;

Security Notes

  • Always use HTTPS in production
  • Never expose your STRIPE_SECRET_KEY
  • Validate order numbers and amounts on your server
  • Consider implementing webhook handling for payment confirmation