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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@acmeticketing/payment-sdk

v1.2.1

Published

With the ACME Payments Card Present JavaScript SDK you can now extend into omni-channel payments with card present offerings. This way you can unify online and physical channels under one platform for consistency and enable new powerful use cases, such as

Downloads

19

Readme

ACME Payments JavaScript SDK

With the ACME Payments Card Present JavaScript SDK you can now extend into omni-channel payments with card present offerings. This way you can unify online and physical channels under one platform for consistency and enable new powerful use cases, such as buying online, upgrade the order in person, or refund in person.

The SDK connects to our card readers which range from stationary to mobile options. Additionally, our SDK connects securely to our PCI Level 1 compliant based platform.

The SDKs are currently available with the JavaScript language so that you could either re-use your web application code to be turned into a Point of Sale (POS) app or create brand new web-based POS solutions.

Installation

ES Module

  • Intended for use with modern bundlers like webpack.
  • This is the recommended approach and will provide the best developer experience.
npm install @acmeticketing/payment-sdk

UMD

UMD builds can be used directly in the browser via a <script> tag. Manually add the index.umd.js script tag to the <head> of your site.

<!-- Somewhere in your site's <head> -->
<script src="https://unpkg.com/@acmeticketing/[email protected]/index.umd.js" async></script>

Usage (ES Module)

All of the examples also apply to the UMD version but instead of importing our library as an ES Module it will be available under the global ACME object.

window.ACME.ACMEPayments.init({
  publishableKey: 'your_publishable_key',
  mid: 'your_mid',
}).then((acmePayments) => {
  // Use the `ACMEPayments` instance
  const terminal = acmePayments.createTerminal({
    onUnexpectedReaderDisconnect: (event) => {
      console.log('onUnexpectedReaderDisconnect', event);
    },
  });
});

Create an ACMETerminal

Creating an instance of ACMETerminal is a simple process, follow these steps:

  1. Use your provided publishable key and merchant identification number (MID).
  2. Create a new instance of ACMETerminal

You can provide some callbacks to be notified of your reader's status among other things.

import { ACMEPayments, ACMETerminal } from '@acmeticketing/payment-sdk';

async function createACMETerminal(): Promise<ACMETerminal> {
  const acmePayments = await ACMEPayments.init({
    publishableKey: 'your_publishable_key',
    mid: 'your_mid',
  });

  const terminal = acmePayments.createTerminal({
    // This callback is required, `createTerminal` will throw an error if you forget to pass it.
    onUnexpectedReaderDisconnect: (event) => {},
    onConnectionStatusChange: (event) => {},
    onPaymentStatusChange: (event) => {},
  });

  return terminal;
}

Making a sale

This example assumes you have already initialized the ACMEPayments SDK and obtained created an instance of ACMETerminal.

Before making a sale you MUST have an active connection to a reader.

Establishing connection with your reader is only required the first time you want to make a sale. Further sales can be made over the same connection.

The process goes like this:

  1. Get a list of available readers
  2. Connect to a reader from the list
  3. Make your sale
import { ACMETerminal, Sale } from '@acmeticketing/payment-sdk';

async function processSale(acmeTerminal: ACMETerminal): Promise<Sale> {
  try {
    const readers = await acmeTerminal.discoverReaders();
    const reader = readers[0];
    await acmeTerminal.connectReader(reader);

    const response = await acmeTerminal.sale({
      charge: { amount: '3.5' },
    });

    return response;
  } catch (error) {
    // handle error
  }
}

Processing a refund

This example assumes you have already initialized the ACMEPayments SDK and obtained created an instance of ACMETerminal.

  • This will not prompt on the reader. It will process the refund back to the card used for payment.
  • We support partial refunds.
import { ACMETerminal, Refund } from '@acmeticketing/payment-sdk';

async function processRefund(acmeTerminal: ACMETerminal): Promise<Refund> {
  try {
    const readers = await acmeTerminal.discoverReaders();
    const reader = readers[0];
    await acmeTerminal.connectReader(reader);

    const response = await acmeTerminal.refund({
      saleId: 'your_sale_id',
      charge: { amount: '3' },
    });

    return response;
  } catch (error) {
    // handle error
  }
}