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

@apppay/react

v1.0.0

Published

React payment modal component for AppPay - Accept cryptocurrency payments with cross-chain support

Readme

@apppay/react

A React component for accepting cryptocurrency payments with cross-chain support. Simple, secure, and powerful.

Features

  • 🚀 Zero Configuration: Auto-detects development vs production environments
  • 🔒 Secure: Payment data loaded securely from AppPay servers
  • 🌐 Cross-Chain: Support for multiple blockchains and tokens
  • Real-Time: Live quotes and transaction updates via WebSocket
  • 🎨 Customizable: Light/dark themes and custom CSS styling
  • 📱 Responsive: Works on all devices
  • 🔑 No API Keys: Everything works with payment IDs only

Installation

npm install @apppay/react

Note: Thirdweb is bundled with this package - no need to install it separately!

Quick Start

import { PaymentModal } from '@apppay/react';
import { ThirdwebProvider } from 'thirdweb/react';

function App() {
  const [isOpen, setIsOpen] = useState(false);
  const paymentId = 'pay_1234567890'; // Get this from your backend

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

      <PaymentModal
        paymentId={paymentId}
        isOpen={isOpen}
        onClose={() => setIsOpen(false)}
        onPaymentComplete={(result) => {
          console.log('Payment successful:', result);
          setIsOpen(false);
        }}
        theme="dark"
      />
    </ThirdwebProvider>
  );
}

API Reference

PaymentModal Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | paymentId | string | ✅ | Unique payment identifier from AppPay | | isOpen | boolean | ✅ | Controls modal visibility | | onClose | () => void | ❌ | Called when user closes modal | | onPaymentComplete | (result: PaymentResult) => void | ❌ | Called on successful payment | | theme | 'light' \| 'dark' | ❌ | UI theme (default: 'light') | | style | React.CSSProperties | ❌ | Custom styling |

PaymentResult

interface PaymentResult {
  paymentId: string;
  transactionHash: string;
  amount: string;
  currency: string;
  status: 'completed' | 'pending' | 'failed';
  timestamp: number;
  metadata?: Record<string, any>;
}

How It Works

  1. Create Payment: Use AppPay API to create a payment and get a paymentId
  2. Show Modal: Pass the paymentId to the PaymentModal component
  3. Auto-Connect: Modal automatically connects to correct API/WebSocket endpoints
  4. Load Data: Payment details are securely loaded from AppPay servers
  5. User Pays: Modal guides user through wallet connection and payment
  6. Success: onPaymentComplete callback is triggered with transaction details

Environment Auto-Detection

The package automatically detects your environment:

| Environment | API Endpoint | WebSocket Endpoint | |-------------|-------------|-------------------| | Development (localhost) | http://localhost:3082 | ws://localhost:3084 | | Production (all others) | https://api.apppay.ai | wss://ws.apppay.ai |

No configuration needed! 🎉

Creating Payments

First, create a payment using the AppPay API:

// Example: Create payment via fetch
const response = await fetch('https://api.apppay.ai/api/mcp/create-payment', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    amount: '99.99',
    currency: 'USD',
    title: 'Premium Subscription',
    description: 'Monthly access to premium features'
  })
});

const { paymentId } = await response.json();

Thirdweb Setup

Make sure to wrap your app with ThirdwebProvider:

import { ThirdwebProvider } from 'thirdweb/react';

function App() {
  return (
    <ThirdwebProvider>
      {/* Your app components */}
    </ThirdwebProvider>
  );
}

Customization

Themes

<PaymentModal
  paymentId={paymentId}
  isOpen={isOpen}
  theme="dark" // or "light"
/>

Custom Styling

The style prop accepts any valid React CSSProperties object and is applied to the modal container:

<PaymentModal
  paymentId={paymentId}
  isOpen={isOpen}
  style={{
    // Modal container styling
    borderRadius: '16px',
    boxShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.25)',
    maxWidth: '500px',
    minHeight: '600px',
    background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
    border: '2px solid #e2e8f0'
  }}
/>

Advanced Styling Examples

Rounded Corners & Shadows:

style={{
  borderRadius: '24px',
  boxShadow: '0 32px 64px -12px rgba(0, 0, 0, 0.35)',
  border: '1px solid rgba(255, 255, 255, 0.1)'
}}

Custom Colors:

style={{
  background: 'linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%)',
  color: 'white'
}}

Size Customization:

style={{
  width: '90vw',
  maxWidth: '600px',
  minHeight: '700px'
}}

Styling Notes

  • CSS Priority: The style prop has higher priority than Tailwind classes
  • Theme Override: Custom background/color will override light/dark theme
  • Responsive: Use vw, vh, % for mobile compatibility
  • Z-Index: Modal has z-50 (z-index: 50) - use style.zIndex to override
  • Animation: Framer Motion animations work with all custom styles
  • Inheritance: Child elements inherit text color from modal container
  • Tailwind Conflicts: Some Tailwind classes may be overridden by style prop

Common Style Overrides

// Override default rounded corners
style={{ borderRadius: '8px' }} // Overrides rounded-xl

// Custom background (overrides theme)
style={{ background: '#f0f0f0' }} // Overrides bg-white/bg-slate-900

// Custom sizing
style={{ maxWidth: '400px', height: '500px' }} // Overrides max-w-md

// Custom shadows
style={{
  boxShadow: '0 10px 40px rgba(0,0,0,0.3)' // Overrides shadow-2xl
}}

Advanced Usage

Using Hooks Directly

import { useRouteDiscovery, usePaymentExecution, AppPayAPI } from '@apppay/react';

function CustomPaymentFlow() {
  const api = new AppPayAPI();
  const { routes, discoverRoutes } = useRouteDiscovery(api);
  const { executePayment, isProcessing } = usePaymentExecution(paymentData);

  // Custom implementation...
}

Error Handling

The modal handles common errors automatically:

  • No Wallet: Prompts user to install/connect wallet
  • Network Issues: Shows retry options
  • Insufficient Funds: Displays helpful error messages
  • Transaction Failures: Provides clear feedback

Security

  • No API Keys: Everything works with payment IDs
  • Server-Side Validation: Payment data is validated on AppPay servers
  • Secure Communication: HTTPS and WSS connections
  • No Sensitive Data: Payment details stay on AppPay infrastructure

Browser Support

  • Chrome 80+
  • Firefox 75+
  • Safari 13+
  • Edge 80+

Contributing

This package is part of the AppPay ecosystem. For contributions or issues, please visit our main repository.

License

MIT © AppPay