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

@jhoose-commerce/stripe-payment

v1.0.10

Published

Stripe payment integration for Jhoose Commerce

Downloads

552

Readme

Jhoose Commerce Stripe Payment extensions

Overview

The @jhoose-commerce/stripe-payment module is a React component library that provides a complete Stripe-powered checkout flow for the Jhoose Commerce e-commerce platform. It handles the entire payment journey from address collection to payment confirmation.

Key Functionality

1. Multi-Step Checkout Process

The module orchestrates a 3-step checkout wizard:

Step 1: Address Collection (StripeCheckoutAddressStep)

  • Collects shipping address using Stripe's address validation
  • Validates completeness before allowing progression
  • Saves address to cart via Jhoose Commerce API

Step 2: Shipping Method Selection (StripeCheckoutShippingMethodStep)

  • Lets customers choose delivery options
  • Updates cart with selected shipping method

Step 3: Payment Processing (StripeCheckoutPaymentStep)

  • Collects payment details using Stripe's PaymentElement
  • Collects billing address using Stripe's AddressElement
  • Creates payment intent via your backend
  • Confirms payment through Stripe
  • Redirects to success page with ?checkout_finished=true query parameter

2. Stripe Integration Architecture

// Loads Stripe.js SDK once
const stripePromise = loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY ?? "");

// Configures Stripe Elements with cart details
const stripeOptions: StripeElementsOptions = {
    mode: 'payment',
    locale: marketContext.language,        // Auto-localizes UI
    amount: (cart?.totalPrice ?? 0) * 100, // Converts to cents
    currency: cart?.currency.code,
    appearance: { theme: 'stripe' }
};

3. Backend Communication Flow

The payment flow works like this:

1. Customer clicks "Pay"
   ↓
2. Module calls → /commerceapi/stripe/paymentintent/{cartId}
   ← Returns: { clientSecret, paymentId, paymentMethodId }
   ↓
3. Module calls → Jhoose Commerce API: checkout.addPayment()
   (Saves payment record with status "Processed")
   ↓
4. Module calls → stripe.confirmPayment()
   (Stripe handles 3D Secure, card verification, etc.)
   ↓
5. Redirect → {returnUrl}/{cartId}/?checkout_finished=true

4. Key Features

Automatic Currency Handling: Converts amounts to minor units (cents/pence) for Stripe ✅ Internationalization: Adapts to market context (language, currency, allowed countries) ✅ Real-time Validation: Each step validates before enabling "Continue" ✅ Cart Synchronization: Updates Jhoose Commerce cart as user progresses ✅ Stripe-Native Components: Uses official Stripe React components (secure, PCI-compliant) ✅ Progressive Disclosure: Collapsible panels show completed step summaries

Integration Example

import { StripeCheckout } from '@jhoose-commerce/stripe-payment';

<StripeCheckout
  checkoutLabels={{
    contactDetails: { sectionHeading: "Shipping Address", ... },
    shippingMethod: { sectionHeading: "Delivery Options", ... },
    payment: { sectionHeading: "Payment Details", ... }
  }}
  cartLabels={{ ... }}
  returnUrl="https://yoursite.com/order-confirmation/"
/>

Dependencies

Peer Dependencies (must be installed by consumer):

  • @jhoose-commerce/components - UI components (cart, forms, checkout steps)
  • @jhoose-commerce/core - API client and data types
  • react ≥19.0.0
  • stripe ^18 - Stripe SDK

Stripe React Libraries (built-in):

  • @stripe/react-stripe-js - React bindings
  • @stripe/stripe-js - Stripe.js loader

What It's NOT

Not a backend service - Requires a backend endpoint at /commerceapi/stripe/paymentintent/{cartId}Not a standalone checkout - Depends on Jhoose Commerce API for cart management ❌ Not payment method agnostic - Specifically designed for Stripe payments only

Common Use Cases

  1. Headless Commerce: Drop-in Stripe checkout for custom Next.js storefronts
  2. Multi-Market Stores: Handles different currencies and locales automatically
  3. React Applications: Pre-built components save weeks of Stripe integration work

Gotchas

⚠️ Environment Variable Required: Must set NEXT_PUBLIC_STRIPE_PUBLIC_KEY or pass key explicitly ⚠️ Backend Dependency: You must implement the /commerceapi/stripe/paymentintent endpoint ⚠️ Cart State Management: Relies on Jhoose Commerce cart context being available via useCart() hook

This module essentially bridges Stripe's payment infrastructure with Jhoose Commerce's cart/order management, providing a production-ready checkout experience with minimal configuration.