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

@pay-com/js

v1.2.2

Published

Pay.com JS loading utility

Downloads

8,271

Readme

Pay Components are ready-to-use PCI DSS compliant payment fields you can embed into your checkout page through simple code. Your branding and styling remain untouched, and you don't have to worry about storing card data.

Installation

To include Pay Components in your project, either install it using npm i @pay-com/js, or use our CDN:

<script type="text/javascript" src="https://js.pay.com/v1"></script>

Get Started

Initialize Pay

To initialize Pay, call Pay.com() with your unique merchant id:

const pay = await Pay.com({ identifier: 'merchant_id' })

Initialize checkout object

In order to be able to start accepting payments, intialize the checkout object:

const checkout = pay.checkout({
  clientSecret: 'payment_session_client_secret',
  onSuccess: payment => {
    // Can be used instead of checkout event listeners
  },
  onFailure: error => {
    // Can be used instead of checkout event listeners
  }
})

You now have a checkout object with which you can render a payment form, validate it, and subscribe to events.

To subscribe to different events, use the checkout.on function:

checkout.on(checkout.EVENT_TYPES.PAYMENT_SUCCESS, payment => {
  // Do something on success
})
checkout.on(checkout.EVENT_TYPES.PAYMENT_PROCESSING, () => {
  // Do something on payment processing
})
checkout.on(checkout.EVENT_TYPES.PAYMENT_FAILURE, error => {
  // Do something on error
})

Render Payment Form

In order to render a payment form, create an empty div which the form will be rendered in, e.g.:

<div id="paycom_checkout"></div>

Once you have the div, call the render function:

checkout.universal({
  container: '#paycom_checkout'
})

Thats it! You are now ready to securely accept payments in your website.

Manual validation and submission

If you wish to render the fields without a submission button for more control, you have to pass the submitButton: false option to the toggles key under the universal function:

checkout.universal({
  container: '#paycom_checkout',
  toggles: {
    submitButton: false
  }
})

Now the form will render without a button. To validate & submit the form, first create a button:

<button id="pay_button">Pay now!</button>

Then, create a click listener on the button:

document.getElementById('pay_button').addEventListener('click', async () => {
  // Validate all fields before submitting
  const { valid } = checkout.validate()

  // If the payment form is valid, continue with the payment
  if (valid) {
    // Can also get the payment from return value of submit function.
    const payment = await checkout.submit()
  }
})