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

@zahlen/checkout-react

v0.1.0

Published

React components for Zahlen Checkout - Modern payment modal

Readme

@zahlen/checkout-react


🚀 Installation

npm install @zahlen/checkout-react @zahlen/checkout
# or
yarn add @zahlen/checkout-react @zahlen/checkout

📖 Quick Start

Option 1: Simple Button (Easiest)

import { ZahlenProvider, ZahlenButton } from '@zahlen/checkout-react';

function App() {
  return (
    <ZahlenProvider apiKey="pk_live_your_api_key">
      <ProductPage />
    </ZahlenProvider>
  );
}

function ProductPage() {
  return (
    <ZahlenButton
      amount={499900}        // ₦4,999 in kobo
      currency="NGN"
      description="Premium Plan"
      onSuccess={(result) => {
        console.log('Paid!', result);
        // Redirect to success page
      }}
      onError={(error) => {
        toast.error(error.message);
      }}
    >
      💳 Pay ₦4,999
    </ZahlenButton>
  );
}

Option 2: useZahlen Hook (Recommended)

import { ZahlenProvider, useZahlen } from '@zahlen/checkout-react';

function App() {
  return (
    <ZahlenProvider apiKey="pk_live_your_api_key" theme="dark">
      <ProductPage />
    </ZahlenProvider>
  );
}

function ProductPage() {
  const { openCheckout, isProcessing } = useZahlen();

  const handleBuy = async () => {
    try {
      const result = await openCheckout({
        amount: 499900,
        currency: 'NGN',
        description: 'Premium Plan',
      });
      console.log('Payment successful!', result);
      router.push('/success');
    } catch (error) {
      console.error('Payment failed:', error);
    }
  };

  return (
    <button onClick={handleBuy} disabled={isProcessing}>
      {isProcessing ? 'Processing...' : 'Buy Now'}
    </button>
  );
}

Option 3: Controlled Component (Full Control)

import { useState } from 'react';
import { ZahlenCheckout } from '@zahlen/checkout-react';
import { Zahlen } from '@zahlen/checkout';

// Initialize once at app entry
Zahlen.init({ apiKey: 'pk_live_your_api_key' });

function ProductPage() {
  const [isOpen, setIsOpen] = useState(false);

  return (
    <>
      <button onClick={() => setIsOpen(true)}>Pay Now</button>

      <ZahlenCheckout
        open={isOpen}
        onClose={() => setIsOpen(false)}
        amount={499900}
        currency="NGN"
        description="Premium Plan"
        onSuccess={(result) => {
          setIsOpen(false);
          router.push('/success');
        }}
        onError={(error) => {
          console.error(error);
        }}
      />
    </>
  );
}

📚 API Reference

<ZahlenProvider>

Wrap your app with this provider to use Zahlen hooks.

<ZahlenProvider
  apiKey="pk_live_xxx"     // Required
  theme="dark"             // Optional: 'dark' | 'light' | 'auto'
>
  {children}
</ZahlenProvider>

useZahlen()

Hook to access Zahlen functionality.

const {
  isInitialized,  // boolean - whether SDK is ready
  isProcessing,   // boolean - whether payment is in progress
  openCheckout,   // (options) => Promise<PaymentResult>
  closeCheckout,  // () => void
  setTheme,       // (theme) => void
} = useZahlen();

<ZahlenButton>

Pre-styled checkout button.

| Prop | Type | Required | Description | |------|------|----------|-------------| | amount | number | ✅ | Amount in smallest unit | | currency | string | ✅ | ISO currency code | | description | string | | Payment description | | customerEmail | string | | Customer email | | metadata | object | | Custom metadata | | onSuccess | function | | Success callback | | onError | function | | Error callback | | onClose | function | | Close callback | | className | string | | CSS class | | style | object | | Inline styles | | disabled | boolean | | Disable button |

<ZahlenCheckout>

Controlled checkout component.

| Prop | Type | Required | Description | |------|------|----------|-------------| | open | boolean | ✅ | Control modal visibility | | onClose | function | ✅ | Close callback | | amount | number | ✅ | Amount in smallest unit | | currency | string | ✅ | ISO currency code | | onSuccess | function | ✅ | Success callback | | onError | function | | Error callback | | description | string | | Payment description |


🎨 Customization

import { Zahlen } from '@zahlen/checkout';

// After init, customize theme
Zahlen.init({
  apiKey: 'pk_live_xxx',
  customStyles: {
    '--zahlen-primary': '#FF6B6B',
    '--zahlen-bg': '#1A1A2E',
  }
});

📄 License

MIT © Zahlen