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

cayan

v1.0.8

Published

Javascript library for Cayan API's

Readme

cayan

A Javascript library for talking to the Cayan APIs

Build Status npm version

Install

yarn add cayan

or

npm install cayan --save

Usage

Genius APIs

Initialize the client with your merchant credentials and the hostname of your CED device.

import { GeniusClient } from "cayan";

const config = {
  MerchantName: "TEST",
  MerchantSiteId: "000000",
  MerchantKey: "00000-00000-00000-00000-00000",
  CEDHostname: "10.0.0.76"
};

const genius = await GeniusClient.createInstance(config);

Once you've initialized the Genius client, here are the operations you now have access to:


StageTransaction

Allows you to submit non-sensitive payment information to the payment gateway and returns a unique key (TransportKey) in the response which will be used for all subsequent steps to identify the transaction. API Docs

const transaction = {
  TransactionType: "SALE",
  ClerkId: "1",
  Dba: "Acme Inc",
  SoftwareName: "Your Project",
  SoftwareVersion: "1",
  Amount: 1.01,
  OrderNumber: "1000",
  TaxAmount: 0.1
};

const result = await genius.StageTransaction(transaction);

CheckStatus

Sends a request to the CED to check which screen the device is on. API Docs

A list of possible CurrentScreen values and their meanings can be found here

const result = await genius.CheckStatus();

// Example Return Value
{
  "Status": "Online",
  "CurrentScreen": "00",
  "ResponseMessage": "",
  "SerialNumber": "WSC00000000",
  "ApplicationVersion": "H1.0.1.68",
  "OSVersion": "7.0",
  "AdditionalParameters": {
    "PaymentDataCaptured": false,
    "RemoveEMVCard": false
  }
}

StartOrder

Initiates the line item display screen and the start of the transaction.

const result = await genius.StartOrder("ORDER-NUMBER-HERE");

// Example Return Value
{
  "Status": "Success",
  "ResponseMessage": "",
  "AdditionalParameters": {}
}

EndOrder

Completes the line item display for transactions completed outside of the Genius CED. Should only be used when payment is accepted outside of the Genius CED. For example, if a consumer pays with cash or check. API Docs

const result = await genius.EndOrder("ORDER-NUMBER-HERE", "Cash | Check | StoreCredit | Other");

// Example Return Value
{
  "Status": "Success",
  "ResponseMessage": "",
  "AdditionalParameters": {}
}

Cancel

Sends a request to the CED to cancel the current transaction API Docs

const result = await genius.Cancel();

// Example Return Value
{
  "Status": "Cancelled",
  "ResponseMessage": "",
  "AdditionalParameters": {}
}

AddItem

Adds an item to the line display screen and display updated data for tax and total amounts API Docs

const result = await genius.AddItem({
  Order: "1000",
  Type: "Sku",
  TypeValue: "xxx",
  UPC: "UPC123",
  Quantity: "1",
  Description: "Pad Prik Pow",
  Amount: "12.25",
  TaxAmount: "0",
  OrderTotal: "12.25",
  OrderTax: "0",
  Category: "None"
});

// Example Return Value
{
  "Status": "Success",
  "ResponseMessage": "",
  "ItemID": "1",
  "AdditionalParameters": {}
}

DiscountItem

Adds a discount line item to the display screen and display updated data for tax and total amounts. This will apply a negative value to the order. Note: If you delete the item associated with the discount, you must also delete the discount. API Docs

const result = await genius.DiscountItem({
  Order: "1000",
  TargetItemID: "1",
  Type: "Sku",
  TypeValue: "xxx",
  UPC: "UPC123",
  Quantity: "1",
  Description: "Pad Prik Pow",
  Amount: "2.25",
  TaxAmount: "0",
  OrderTotal: "10.00",
  OrderTax: "0",
  Category: "None"
});

// Example Return Value
{
  "Status": "Success",
  "ResponseMessage": "",
  "ItemID": "3",
  "AdditionalParameters": {}
}

DeleteItem

Deletes an item from the items list API Docs

const result = await genius.DeleteItem({
  Order: "1000",
  TargetItemID: "1",
  OrderTotal: "0",
  OrderTax: "0"
});

// Example Return Value
{
  "Status": "Success",
  "ResponseMessage": "",
  "AdditionalParameters": {}
}

DeleteAllItems

Deletes all items from the items list API Docs

const result = await genius.DeleteAllItems({
  Order: "1000",
  RetainPaymentData: CEDBoolean.False,
  OrderTotal: "0",
  OrderTax: "0"
});

// Example Return Value
{
  "Status": "Success",
  "ResponseMessage": "",
  "AdditionalParameters": {}
}

UpdateItem

Updates an existing item API Docs

const result = await genius.UpdateItem({
  Order: "1000",
  TargetItemID: "1",
  Type: "Sku",
  TypeValue: "xxx",
  UPC: "UPC123",
  Quantity: "2",
  Description: "Pad Prik Pow",
  Amount: "12.25",
  TaxAmount: "0",
  OrderTotal: "24.50",
  OrderTax: "0",
  Category: "None"
});

// Example Return Value
{
  "Status": "Success",
  "ResponseMessage": "",
  "ItemID": "4",
  "AdditionalParameters": {}
}

UpdateTotal

Updates the order totals without adding/removing items API Docs

const result = await genius.UpdateTotal({
  Order: "1000",
  OrderTotal: "20.25",
  OrderTax: "0"
});

// Example Return Value
{
  "Status": "Success",
  "ResponseMessage": "",
  "AdditionalParameters": {}
}

License

MIT

Disclaimer

This software is not developed by or supported by Cayan & TSYS.