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

@frizzyondabeat/react-karrabo

v1.3.0

Published

React library for embedding your payment gateway checkout inline or via redirect

Readme


Installation

# npm
npm install @frizzyondabeat/react-karrabo

# yarn
yarn add @frizzyondabeat/react-karrabo

# pnpm
pnpm add @frizzyondabeat/react-karrabo

GitHub Packages users: add a .npmrc to your project first:

@frizzyondabeat:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN

Quick Start

import { usePayment } from '@frizzyondabeat/react-karrabo';

function CheckoutButton() {
  const initializePayment = usePayment({
    publicKey: 'your-public-key',
    checkoutBaseUrl: 'https://checkout.karrabo.com',
    email: '[email protected]',
    amount: 5000,
    currency: 'NGN',
  });

  return (
    <button
      onClick={() =>
        initializePayment({
          onSuccess: (response) => console.log('Payment successful', response),
          onClose: () => console.log('Checkout closed'),
          onError: (error) => console.error('Payment failed', error),
        })
      }
    >
      Pay ₦5,000
    </button>
  );
}

Payment Modes

inline (default)

Opens a centered modal overlay with the checkout embedded in an iframe. The modal appears with a smooth loading spinner, then resizes to fit the checkout page automatically.

initializePayment({ /* mode defaults to 'inline' */ });

redirect

Navigates the user to a payment link URL in the same tab.

const initializePayment = usePayment({
  publicKey: 'your-public-key',
  checkoutBaseUrl: 'https://checkout.karrabo.com',
  email: '[email protected]',
  amount: 5000,
  mode: 'redirect',
  paymentLinkUrl: 'https://pay.karrabo.com/link/abc123',
});

new_tab

Opens the checkout in a new browser tab.

const initializePayment = usePayment({
  publicKey: 'your-public-key',
  checkoutBaseUrl: 'https://checkout.karrabo.com',
  email: '[email protected]',
  amount: 5000,
  mode: 'new_tab',
});

API Reference

usePayment(config)

A React hook that accepts your checkout configuration and returns an initializePayment function.

const initializePayment = usePayment(config: HookConfig);

Call initializePayment to trigger the checkout:

initializePayment({
  onSuccess?: (response?: any) => void;
  onClose?: () => void;
  onError?: (error?: any) => void;
  config?: Partial<PaymentConfig>; // override hook-level config per call
});

PaymentConfig

| Prop | Type | Required | Default | Description | |------|------|:--------:|---------|-------------| | publicKey | string | ✅ | — | Your Karrabo public key | | checkoutBaseUrl | string | ✅ | — | Base URL of the Karrabo checkout | | email | string | ✅ | — | Customer's email address | | amount | number | ✅ | — | Amount in the smallest currency unit (e.g. kobo for NGN) | | currency | Currency | — | 'NGN' | Payment currency | | reference | string | — | — | Unique transaction reference | | firstName | string | — | — | Customer's first name | | lastName | string | — | — | Customer's last name | | phone | string \| number | — | — | Customer's phone number | | label | string | — | — | Display label on the checkout | | channels | PaymentChannel[] | — | — | Payment channels to enable | | metadata | PaymentMetadata | — | — | Extra data attached to the transaction | | mode | PaymentMode | — | 'inline' | How to open the checkout | | paymentLinkUrl | string | — | — | Direct payment link (used with redirect or new_tab mode) |


Types

type Currency = 'NGN' | 'GHS' | 'USD' | 'ZAR' | 'KES' | 'XOF' | 'GBP' | 'EUR' | (string & {});

type PaymentChannel = 'card' | 'bank' | 'ussd' | 'qr' | 'mobile_money' | 'bank_transfer';

type PaymentMode = 'inline' | 'redirect' | 'new_tab';

interface PaymentMetadata {
  custom_fields?: PaymentCustomField[];
  [key: string]: any;
}

interface PaymentCustomField {
  display_name: string;
  variable_name: string;
  value: any;
}

Override Config Per Call

You can set base config on the hook and override specific fields per call:

const initializePayment = usePayment({
  publicKey: 'your-public-key',
  checkoutBaseUrl: 'https://checkout.karrabo.com',
  email: '[email protected]',
  amount: 0,
  currency: 'NGN',
});

// Override amount and reference for each unique transaction
initializePayment({
  config: { amount: 10000, reference: 'ORDER_001' },
  onSuccess: (res) => console.log(res),
});

TypeScript

This library ships with full TypeScript declarations. All types are exported directly:

import type {
  PaymentConfig,
  HookConfig,
  InitializePayment,
  Currency,
  PaymentMode,
  PaymentChannel,
  PaymentMetadata,
  PaymentCustomField,
} from '@frizzyondabeat/react-karrabo';

Peer Dependencies

| Package | Version | |---------|---------| | react | ^16.0.0 \|\| ^17.0.0 \|\| ^18.0.0 \|\| ^19.0.0 | | react-dom | ^16.0.0 \|\| ^17.0.0 \|\| ^18.0.0 \|\| ^19.0.0 |


Test Coverage

| File | Statements | Branches | Functions | Lines | |------|:----------:|:--------:|:---------:|:-----:| | payment-actions.ts | 98.14% | 87.3% | 87.5% | 98.91% | | use-payment.ts | 100% | 100% | 100% | 100% | | All files | 98.33% | 89.33% | 92.3% | 99.03% |

Run coverage locally:

npx jest --coverage

License

MIT © Karrabo