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

@w3-payments/adapters

v1.0.0

Published

TypeScript interfaces for payment vendor adapters

Readme

@payments-platform/adapters

Payment vendor adapters for the payments-platform ecosystem.

Overview

This package contains vendor-specific payment adapters that implement the standardized PaymentVendorInterface. Each adapter handles the integration with a specific payment provider (Mesh, IronPay, etc.) while maintaining a consistent interface for the UI components.

Architecture

Plugin System

  • Vendor Agnostic: All adapters implement the same interface
  • Hot Swappable: Switch vendors in <2 hours via configuration
  • Isolated: Each vendor adapter is completely independent
  • Type Safe: Full TypeScript interfaces ensure compatibility

Core Interface

All onramp adapters must implement OnrampAdapter:

interface OnrampAdapter {
  initiate(request: OnrampRequest): Promise<OnrampResponse>;
  getStatus(vendorTxId: string): Promise<OnrampStatus>;
  parseWebhook(rawPayload: object): Promise<ParsedWebhook>;
}

Available Onramp Adapters

MeshAdapter

  • Status: 🚧 Ready for implementation
  • Type: Onramp (fiat-to-crypto)
  • Methods: Crypto payments via wallet and exchanges
  • Currencies: BTC, ETH, USDC, USDT
  • Integration: Uses Mesh Connect API

Future Adapters

  • IronPay: Onramp via ACH bank transfers
  • Stripe: Onramp via credit/debit cards
  • Coinbase: Onramp via Coinbase Pay

Usage

import { MeshAdapter } from '@payments-platform/adapters';

// Configure adapter
const meshAdapter = new MeshAdapter();
meshAdapter.configure({
  apiKey: 'your-mesh-api-key',
  environment: 'production'
});

// Use with payments-core
import { PaymentWidget } from '@payments-platform/core';

<PaymentWidget
  adapters={[meshAdapter]}
  onSuccess={handleSuccess}
  onError={handleError}
/>

Creating New Adapters

1. Implement the Interface

import { PaymentVendorInterface } from './shared/PaymentVendorInterface';

export class YourVendorAdapter implements PaymentVendorInterface {
  readonly vendorId = 'your-vendor';
  readonly vendorName = 'Your Vendor';
  
  // Implement all required methods...
}

2. Add to Registry

// The registry will auto-discover adapters
export { YourVendorAdapter } from './your-vendor/YourVendorAdapter';

3. Follow the Patterns

  • Use async/await for all operations
  • Handle errors gracefully with proper error codes
  • Implement proper cleanup in destroy()
  • Support health checking for failover scenarios

Team Responsibilities

Integration Team: Works in this package to implement:

  • Vendor-specific API integrations
  • Authentication and credential management
  • Payment flow implementations
  • Error handling and retry logic
  • Webhook processing
  • Health monitoring

UI Team: Consumes the interfaces from this package but doesn't modify implementations.

Development

# Install dependencies
pnpm install

# Run tests for all adapters
pnpm test

# Test specific adapter
pnpm test mesh

# Build package
pnpm build

Testing

Each adapter includes comprehensive tests:

# Unit tests
pnpm test:unit

# Integration tests (requires test credentials)
pnpm test:integration

# Mock tests (no real API calls)
pnpm test:mock

Configuration

Adapters are configured via environment variables or runtime config:

// Environment-based config
const adapter = new MeshAdapter();
adapter.configure({
  apiKey: process.env.MESH_API_KEY,
  environment: process.env.NODE_ENV
});

// Or runtime config
adapter.configure({
  apiKey: 'runtime-key',
  baseUrl: 'custom-url'
});

Error Handling

All adapters follow standardized error patterns:

interface PaymentError {
  code: string;           // VENDOR_UNAVAILABLE, INSUFFICIENT_FUNDS, etc.
  message: string;        // User-friendly message
  details?: any;          // Additional context
  timestamp: string;      // ISO 8601
  requestId: string;      // For tracking
}

Status

🚧 Foundation Complete - Core interfaces established, vendor implementations ready for development.

Dependencies

  • TypeScript 5+
  • Node.js 18+ (for integration tests)
  • Vendor SDKs (added per adapter as needed)