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

simplecheckout-sdk

v1.8.0

Published

A modern, secure JavaScript SDK for credit card data collection with PCI-compliant handling and customizable styling

Readme

SimpleCheckout SDK

npm version npm downloads

A modern, reusable TypeScript package for securely storing credit card information using SimpleCheckout.

Installation

npm install simplecheckout-sdk

Quick Start

Credit Card Form

import SimpleCheckout from 'simplecheckout-sdk';

// Initialize SimpleCheckout with your publishable key
const simplecheckout = new SimpleCheckout('pk_sandbox_xxxx');

// Create and mount a credit card form
const creditCardForm = await simplecheckout.initEmbeddedCreditCardForm({
  customerId: 'customer_uuid',  // Required: Your customer's unique identifier
  onSuccess: (result) => {
    console.log('Card stored! Token:', result.token);
    // Use the token in your application
  },
  onError: (error) => {
    console.error('Error:', error.message);
  }
});

// Mount the form to a container
creditCardForm.mount('#container');

CVC Verification Form

const simplecheckout = new SimpleCheckout('pk_sandbox_xxxx');

// Create and mount a CVC verification form
const cvcForm = await simplecheckout.initCVCVerificationForm({
  code: 'verification_code_from_url',
  onSuccess: (result) => {
    console.log('CVC verified successfully!');
  },
  onError: (error) => {
    console.error('Verification failed:', error.message);
  }
});

// Mount the form to a container
cvcForm.mount('#container');

Account Form

Connect customer accounts for third-party shops (e.g., Zara, Nike) in a secure, write-only manner.

const simplecheckout = new SimpleCheckout('pk_sandbox_xxxx');

// Create and mount an account form to connect shop accounts
const accountForm = await simplecheckout.initAccountForm({
  customerId: 'customer_uuid',       // required - your customer's ID
  loginSourceId: 'login_source_uuid',// required - the shop/service ID
  onSuccess: (result) => {
    console.log('Account connected successfully!');
    console.log('Account ID:', result.id);
    console.log('Is default:', result.is_default);
  },
  onError: (error) => {
    console.error('Error connecting account:', error.message);
  }
});

// Mount to a DOM container
accountForm.mount('#account-container');

Key Features:

  • Personalized experiences: Enable your customers to connect their accounts from other shops for tailored recommendations and personalized shopping
  • Simple integration: Easy-to-use form that seamlessly fits into your application flow.

Response Format:

{
  id: string;            // Account record ID
  customer_id: string;   // Your customer's ID
  login_source_id: string; // The shop/service ID
  is_default: boolean;   // Whether this is the default account
  label: string;         // Optional label for the account
  created_at: string;    // ISO 8601 timestamp
  updated_at: string;    // ISO 8601 timestamp
}

HTML Setup

<!-- Just provide a container element -->
<div id="container"></div>

That's it! The SimpleCheckout package will handle everything else.

API Reference

SimpleCheckout(publishableKey)

Creates a new SimpleCheckout instance.

Parameters:

  • publishableKey (string, required) - Your SimpleCheckout publishable key

Returns: SimpleCheckout instance

simplecheckout.listLoginSources()

Fetches all available login sources (shops/services) that customers can connect their accounts to.

const simplecheckout = new SimpleCheckout('pk_sandbox_xxxx');

const response = await simplecheckout.listLoginSources();
console.log(response.login_sources); // Array of login sources
console.log(response.total);         // Total count

Returns: Promise

Response Format:

{
  login_sources: [
    {
      id: string;      // Login source ID (use this for initAccountForm)
      domain: string;  // e.g., "zara.com"
      name: string;    // e.g., "Zara"
    }
  ],
  total: number;
}

simplecheckout.initEmbeddedCreditCardForm(options)

Creates a new embedded credit card form.

Parameters:

  • options (object, required) - Form configuration options

Options:

  • customerId (string, required) - Your customer's unique identifier
  • onSuccess (function, optional) - Callback when card is stored successfully
  • onError (function, optional) - Callback when an error occurs
  • styling (object, optional) - Custom field styling

Returns: Promise - The credit card form instance

creditCardForm.mount(selector)

Mounts the form to a container element.

Parameters:

  • selector (string) - CSS selector for the container element

Returns: CreditCardForm - Returns self for chaining

creditCardForm.unmount()

Unmounts the form from its container.

Returns: CreditCardForm - Returns self for chaining

creditCardForm.submit()

Submits the form programmatically.

Returns: Promise - Promise resolving to the card token data

creditCardForm.getState()

Gets the current form state.

Returns: Object - Current form state

creditCardForm.updateStyling(styling)

Updates the form styling.

Parameters:

  • styling (object) - New styling options

Returns: CreditCardForm - Returns self for chaining

simplecheckout.initCVCVerificationForm(options)

Creates a new CVC verification form.

Parameters:

  • options (object) - Form configuration options

Options:

  • code (string, required) - The verification code from the URL
  • onSuccess (function) - Callback when CVC is verified successfully
  • onError (function) - Callback when verification fails
  • styling (object) - Custom field styling (optional)

Returns: Promise - The CVC verification form instance

cvcVerificationForm.mount(selector)

Mounts the form to a container element.

Parameters:

  • selector (string) - CSS selector for the container element

Returns: CVCVerificationForm - Returns self for chaining

cvcVerificationForm.unmount()

Unmounts the form from its container.

Returns: CVCVerificationForm - Returns self for chaining

cvcVerificationForm.submit()

Submits the form programmatically.

Returns: Promise - Promise resolving to the verification result

cvcVerificationForm.updateStyling(styling)

Updates the form styling.

Parameters:

  • styling (object) - New styling options

Returns: CVCVerificationForm - Returns self for chaining

simplecheckout.initAccountForm(options)

Creates a new account form for connecting customer accounts to third-party shops.

Parameters:

  • options (object) - Account form configuration options

Options:

  • customerId (string, required) - Your customer's unique ID
  • loginSourceId (string, required) - The shop/service ID to connect
  • onSuccess (function) - Callback when account is connected successfully
  • onError (function) - Callback when an error occurs

Returns: Promise - The account form instance

accountForm.mount(selector)

Mounts the form to a container element. The form will be automatically styled with the shop's branding (logo, name, colors).

Parameters:

  • selector (string) - CSS selector for the container element

Returns: AccountForm - Returns self for chaining

accountForm.unmount()

Unmounts the form from its container.

Returns: AccountForm - Returns self for chaining

License

MIT License - see LICENSE file for details.