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

@slashfi/elements-react

v0.0.2

Published

React bindings for confirming a Slash PaymentIntent.

Readme

@slashfi/elements-react

React Elements that render the payment-method form for one Slash PaymentIntent and confirm it from the browser.

Your server creates the intent and hands the clientSecret to the page; the SDK renders the form, tokenizes the payment method, and runs any buyer step such as 3-D Secure. You keep full control of the surrounding checkout UI, including the email, name, and billing-address fields.

Requires React 18 or 19.

Install

npm install @slashfi/elements-react

Quickstart

  1. Your server calls POST /payments/payment-intent and returns the clientSecret to the browser.
  2. Wrap your checkout in <PaymentProvider clientSecret={...}>, render <PaymentElement /> where the form belongs, and render the required <BrandingElement />.
  3. Collect email, name, and billing address in your own fields, then call confirm() from usePaymentElements().
  4. Treat the result as "the buyer is done", not "the payment settled". Fulfill from your server when the intent's status becomes succeeded.
import { useState } from 'react';
import {
  BrandingElement,
  PaymentElement,
  PaymentProvider,
  usePaymentElements,
  type PaymentError,
} from '@slashfi/elements-react';

function CheckoutForm() {
  const payment = usePaymentElements();
  const [email, setEmail] = useState('');
  const [name, setName] = useState('');
  const [postalCode, setPostalCode] = useState('');
  const [error, setError] = useState<PaymentError | null>(null);
  const [submitting, setSubmitting] = useState(false);

  if (payment.state === 'loading') return <p>Loading…</p>;
  if (payment.state === 'error') return <p>{payment.error.message}</p>;

  async function handlePay() {
    setSubmitting(true);
    setError(null);

    const result = await payment.confirm({
      email,
      name,
      billingAddress: { line1: '123 Main St', postalCode, country: 'US' },
      returnUrl: 'https://merchant.example/checkout/complete',
    });

    setSubmitting(false);

    if (result.type === 'error') {
      setError(result.error);
      return;
    }

    // The buyer is done. This is not a settlement guarantee — your server
    // fulfills when the intent reaches `succeeded`.
    window.location.assign(`/orders/pending?pi=${result.paymentIntentId}`);
  }

  return (
    <>
      <input value={email} onChange={(e) => setEmail(e.target.value)} placeholder="Email" />
      <input value={name} onChange={(e) => setName(e.target.value)} placeholder="Name on card" />
      <input value={postalCode} onChange={(e) => setPostalCode(e.target.value)} placeholder="ZIP" />

      <PaymentElement />

      {error && <p role="alert">{error.message}</p>}

      <button
        type="button"
        disabled={!payment.canConfirm || submitting}
        onClick={() => void handlePay()}
      >
        Pay
      </button>

      {/* Required. Payments are blocked on pages that omit this. */}
      <BrandingElement />
    </>
  );
}

export function Checkout({ clientSecret }: { clientSecret: string }) {
  return (
    <PaymentProvider clientSecret={clientSecret}>
      <CheckoutForm />
    </PaymentProvider>
  );
}

Documentation

Check the docs for more information: docs.slash.com/docs/payments/payment-elements