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

@waffo/payment-sdk

v1.0.5

Published

Waffo Payment SDK for secure card tokenization

Readme

Waffo Payment SDK

npm version License: MIT

Secure card tokenization SDK with 3DS verification support.

📦 Installation

npm / pnpm

npm install @waffo/payment-sdk
# or
pnpm add @waffo/payment-sdk

CDN (unpkg)

<!-- Latest version -->
<script src="https://unpkg.com/@waffo/payment-sdk"></script>

<!-- Specific version (recommended for production) -->
<script src="https://unpkg.com/@waffo/[email protected]"></script>

🚀 Usage

npm / ES Module

import WaffoSDK from '@waffo/payment-sdk';

// Initialize SDK
const sdk = new WaffoSDK('your-client-api-key', {
  env: 'prod',        // 'prod' | 'testing' | 'sandbox'
  locale: 'en'        // Optional, default 'en'
});

// Submit tokenization request
const result = await sdk.tokenizationSubmit('token-session-id', {
  tokenDataVerification: false,  // Optional, validate card data, default false
  tokenData: {
    pan: '4111111111111111',     // Card number
    name: 'John Doe',             // Cardholder name
    expiry: '12/2025',            // Expiry date MM/YYYY
    cvv: '123'                    // CVV (optional)
  },
  billingAddress: {               // Optional
    countryCode: 'USA',
    region: 'CA',
    city: 'San Francisco',
    postalCode: '94102',
    address: '123 Main St'
  }
});

// Handle result
if (result.success) {
  console.log('Token Request ID:', result.data.tokenRequestId);
  if (result.data.validateUrl) {
    // 3DS verification required
    window.location.href = result.data.validateUrl;
  }
} else {
  console.error('Error:', result.error.code, result.error.message);
}

// Destroy SDK (cleanup resources)
sdk.destroy();

CDN / UMD

<!DOCTYPE html>
<html>
<head>
  <script src="https://unpkg.com/@waffo/payment-sdk"></script>
</head>
<body>
  <script>
    // WaffoSDK is automatically mounted to window
    const sdk = new WaffoSDK('your-client-api-key', {
      env: 'prod',
      locale: 'en'
    });

    async function submitPayment() {
      const result = await sdk.tokenizationSubmit('token-session-id', {
        tokenData: {
          pan: '4111111111111111',
          name: 'John Doe',
          expiry: '12/2025',
          cvv: '123'
        }
      });

      if (result.success) {
        console.log('Success:', result.data.tokenRequestId);
      } else {
        console.error('Error:', result.error);
      }
    }
  </script>
</body>
</html>

📖 API Reference

new WaffoSDK(clientApiKey, options)

Create an SDK instance.

Parameters:

  • clientApiKey (string): Client API key
  • options (object):
    • env (string): Environment, values: 'prod' | 'testing' | 'sandbox'
    • locale (string): Language code, e.g. 'en', 'ja', 'zh' (optional, default 'en')

Returns: WaffoSDK instance


sdk.tokenizationSubmit(tokenSessionId, request)

Submit card tokenization request.

Parameters:

  • tokenSessionId (string): Token session ID
  • request (object):
    • tokenDataVerification (boolean): Validate card data (optional, default false)
    • tokenData (object): Card data
      • pan (string): Card number
      • name (string): Cardholder name
      • expiry (string): Expiry date, format MM/YYYY
      • cvv (string): CVV security code (optional)
    • billingAddress (object): Billing address (optional)
      • countryCode (string): Country code (ISO 3166-1 alpha-3)
      • region (string): State/Province/Region
      • city (string): City
      • postalCode (string): Postal code
      • address (string): Street address

Returns: Promise<TokenizationResult>

Success Response:

{
  success: true,
  data: {
    tokenRequestId: string,
    validateUrl?: string  // If 3DS verification is required
  }
}

Error Response:

{
  success: false,
  data: null,
  error: {
    code: string,
    message: string
  }
}

Error Codes:

| Error Code | Description | |------------|-------------| | 011001P001 | Wrong parameters. | | 011001P002 | Idempotent param mismatch error. | | 011001B004 | Invalid expiry date format. | | 011001B005 | The card has been expired. | | 011001B006 | The card's BIN has been denied. | | 011001B024 | The token session has expired. | | 011001B025 | Card information is invalid. - pan, name, expiry are required | | 011001B027 | The token session is invalid. | | 011001B031 | The merchant contract not matched. | | 011001S001 | System process failed. |


sdk.destroy()

Destroy SDK instance and cleanup resources.

Parameters: None

Returns: void

📄 License

MIT © Waffo