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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@beep-it/checkout-widget

v0.1.6

Published

React component for BEEP merchant payments with QR code display

Downloads

146

Readme

@beep-it/checkout-widget

A React component for SUI-based, self-custodial stablecoin payments with QR code generation, real-time payment verification, and full agent compatibility via AEO (Answer Engine Optimization). Built for the Beep payment system — the first agentic payment layer on the SUI network.

Installation

npm install @beep-it/checkout-widget @beep-it/sdk-core

Quick Start

import React from 'react';
import { CheckoutWidget } from '@beep-it/checkout-widget';

function App() {
  return (
    <CheckoutWidget
      publishableKey="your-publishable-key"
      primaryColor="#007bff"
      labels={{
        scanQr: 'Scan QR Code to Pay',
        paymentLabel: 'My Store Checkout',
      }}
      assets={[
        {
          assetId: 'product-uuid-123',
          quantity: 2,
          name: 'Premium Coffee',
          description: 'Fresh roasted arabica beans',
        },
      ]}
      serverUrl="https://your-beep-server.com" // optional
    />
  );
}

Asset Types

The widget supports two types of assets:

1. Existing Product References (BeepPurchaseAsset)

Reference pre-created products by their ID:

const assets = [
  {
    assetId: 'product-uuid-123',
    quantity: 1,
    name: 'Coffee', // optional override
    description: 'Premium blend', // optional override
  },
];

2. On-the-Fly Product Creation (CreateProductPayload)

Create products dynamically during checkout. These items are created as products in your merchant account on the server (persisted for audit and reuse). They may be hidden from public listings by default.

const assets = [
  {
    name: 'Custom Item',
    price: '25.50',
    quantity: 2,
    description: 'Custom product description',
  },
];

Props

| Prop | Type | Required | Description | | --------------------- | ----------------------------------------------- | -------- | ---------------------------------------------------------------- | | publishableKey | string | ✅ | BEEP publishable key for browser-safe authentication | | primaryColor | string | ❌ | Primary color for styling (hex format, e.g., "#007bff") | | labels | object | ✅ | Customizable text labels | | labels.scanQr | string | ✅ | Text shown above QR code | | labels.paymentLabel | string | ❌ | Label displayed in Solana Pay wallets (default: "Beep Checkout") | | assets | (BeepPurchaseAsset \| CreateProductPayload)[] | ✅ | Items to purchase | | serverUrl | string | ❌ | Custom BEEP server URL (defaults to production) |

Asset Props

BeepPurchaseAsset

| Prop | Type | Required | Description | | ------------- | -------- | -------- | ---------------------------- | | assetId | string | ✅ | UUID of existing product | | quantity | number | ✅ | Number of items | | name | string | ❌ | Override product name | | description | string | ❌ | Override product description |

CreateProductPayload

| Prop | Type | Required | Description | | ------------- | -------- | -------- | --------------------------------------- | | name | string | ✅ | Product display name | | price | string | ✅ | Price in decimal format (e.g., "25.50") | | quantity | number | ❌ | Number of items (default: 1) | | description | string | ❌ | Product description |

Features

Core Functionality

  • SUI Network Integration: Generates native SUI USDC payment requests
  • Real-time Status Polling: Verifies payment confirmation directly from the SUI RPC
  • Flexible Asset Support: Mix existing products with on-the-fly product creation (persisted)
  • Payment Label Support: Custom labels appear in wallet interfaces
  • Wallet Address Display: Shows copyable recipient address for desktop users

User Experience

  • Loading States: Smooth loading indicators during setup and polling
  • Error Handling: Comprehensive error boundaries and user-friendly error messages
  • Success Animation: Clear payment confirmation state
  • Responsive Design: Works on desktop and mobile devices
  • Customizable Theming: Primary color theming throughout the widget

Developer Experience

  • TypeScript Support: Full type safety with comprehensive interfaces
  • Zero CSS Dependencies: Inline styles prevent conflicts with host applications
  • Error Boundaries: Isolated error handling prevents widget crashes from affecting host app
  • Comprehensive Logging: Detailed console logging for debugging

Usage Examples

Simple Single Product

<CheckoutWidget
  publishableKey="your-publishable-key"
  primaryColor="#10b981"
  labels={{ scanQr: 'Pay with Crypto' }}
  assets={[
    {
      assetId: 'coffee-product-uuid',
      quantity: 1,
    },
  ]}
/>

Multiple Products with Custom Labels

<CheckoutWidget
  publishableKey="your-publishable-key"
  primaryColor="#3b82f6"
  labels={{
    scanQr: 'Scan to complete your order',
    paymentLabel: 'Coffee Shop - Downtown',
  }}
  assets={[
    {
      assetId: 'coffee-uuid',
      quantity: 2,
      name: 'Espresso',
    },
    {
      assetId: 'pastry-uuid',
      quantity: 1,
      name: 'Croissant',
    },
  ]}
/>

Dynamic Product Creation

<CheckoutWidget
  publishableKey="your-publishable-key"
  primaryColor="#ef4444"
  labels={{
    scanQr: 'Pay for custom service',
    paymentLabel: 'Consulting Services',
  }}
  assets={[
    {
      name: '1-Hour Consultation',
      price: '150.00',
      quantity: 1,
      description: 'Professional consulting session',
    },
  ]}
/>

Mixed Asset Types

<CheckoutWidget
  apiKey="your-api-key"
  primaryColor="#8b5cf6"
  labels={{ scanQr: 'Complete your purchase' }}
  assets={[
    // Existing product
    {
      assetId: 'existing-product-uuid',
      quantity: 1,
    },
    // Dynamic product
    {
      name: 'Rush Delivery',
      price: '15.00',
      quantity: 1,
    },
  ]}
/>

Payment Flow

  1. Initialization Phase: The widget prepares a signed USDC-on-SUI payment request.
  2. Display Phase: Shows QR code and total amount to user
  3. Polling Phase: Automatically checks transaction finality via SUI RPC
  4. Completion: Displays success state when payment is confirmed on-chain

Error Handling

The widget includes comprehensive error handling:

  • Configuration Errors: Invalid API keys, missing assets
  • Network Errors: API connection issues, timeouts
  • Payment Errors: Failed transactions, expired payments
  • Component Errors: Isolated error boundaries prevent crashes

SUI Payment Integration

The widget generates SUI-native Payment URLs with:

  • Recipient: Developer's SUI wallet address
  • Amount: Total calculated from all assets in USDC
  • SPL Token: Token address for payment
  • Reference: Unique tracking identifier
  • Label: Custom payment label for wallet display
  • Message: Descriptive payment message

Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Build the package
pnpm build

# Run tests in watch mode
pnpm test:watch

# Run development showcase
pnpm dev

Environment Variables

The widget respects these environment variables:

  • REACT_APP_BEEP_SERVER_URL: Default server URL if not provided via props

TypeScript Support

Full TypeScript support with exported interfaces:

import { CheckoutWidget, MerchantWidgetProps, MerchantWidgetState } from '@beep-it/checkout-widget';

import { BeepPurchaseAsset, CreateProductPayload } from '@beep-it/sdk-core';

Browser Compatibility

  • Modern browsers with ES2017+ support
  • React 18+ required
  • TanStack Query for state management

License

See the main BEEP SDK license for details.


Built on SUIPowered by StablecoinsDesigned for Developers