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 🙏

© 2026 – Pkg Stats / Ryan Hefner

classy-pay-client

v1.1.4

Published

Client for Classy Pay.

Downloads

1,119

Readme

classy-pay-client

Simple client for Classy Pay.

installation

$ yarn install classy-pay-client

usage

PayClient.request(appId, method, resource, payload, params, callback)

const PayClient = require('classy-pay-client')({
  apiUrl: 'https://pay.classy.org',
  timeout: 10000,
  token: 'YOUR_TOKEN'
  secret: 'YOUR_SECRET'
});

PayClient.get(0, '/transaction/1', (error, result) => {
  if (error) {
    console.log(error);
  } else {
    console.log(result);
  }
});

PayClient.request(0, 'GET', '/transaction/1', null, null, (error, result) => {
  if (error) {
    console.log(error);
  } else {
    console.log(result);
  }
});

Functions

getHeaders(context, method, resource, payload) ⇒ Object

Get all the necessary headers for the request.

Kind: global function
Returns: Object - the headers objects

| Param | Type | Description | | --- | --- | --- | | context | Object | the request context | | method | String | the HTTP method for the request | | resource | String | the resource being requested | | payload | Object | the body of the request |

getQs(appId, params) ⇒ Object

Build the request query.

Kind: global function
Returns: Object - params for request

| Param | Type | Description | | --- | --- | --- | | appId | Number | the pay application id | | params | Object | params passed by client user |

getOptions(context, appId, method, resource, payload, params) ⇒ Object

Get the request options.

Kind: global function
Returns: Object - the options for the request

| Param | Type | Description | | --- | --- | --- | | context | Object | the request context | | appId | Number | the pay application id | | method | String | the http method | | resource | String | the resource for the request | | payload | Object | the body of the request | | params | Object | the params provided by the caller |

getResult(error, response, body) ⇒ Object

Get the response for http request.

Kind: global function
Returns: Object - a well formed response object

| Param | Type | Description | | --- | --- | --- | | error | Object | the error | | response | Object | the http response | | body | Object | the body of the response |

request(context, appId, method, resource, payload, params, callback)

A general Pay request.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | context | Object | the context for the request | | appId | Number | the pay application id | | method | String | the http method | | resource | String | the pay resource | | payload | Object | the payload for the request | | params | Object | the parameters for the request | | callback | Method | a callback |

getMax(context, appId, resource) ⇒ Number

Retrieve the total number of objects for the resource.

Kind: global function
Returns: Number - the total number of objects for the resource

| Param | Type | Description | | --- | --- | --- | | context | Object | the context for the request | | appId | Number | the pay application id | | resource | String | the pay resource |

getAll(context, appId, resource, max, collection) ⇒ Promise

Get all the objects for a resource.

Kind: global function
Returns: Promise - a promise when resolved populates the collection

| Param | Type | Description | | --- | --- | --- | | context | Object | the context for the request | | appId | Number | the pay application id | | resource | String | the pay resource | | max | Number | total objects to retrieve | | collection | Array | the collection to add objects to |

forList(context, appId, resource, callback)

Get all objects.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | context | Object | the context for the request | | appId | Number | the pay application id | | resource | String | the pay resource | | callback | function | the callback |

forObject(context, appId, method, resource, body, callback)

Get an object.

Kind: global function

| Param | Type | Description | | --- | --- | --- | | context | Object | the context for the request | | appId | Number | the pay application id | | method | String | the http method | | resource | String | the pay resource | | body | Object | the body of the request | | callback | function | the callback |

list(context, appId, resource, callback) ⇒ Array

Get a list of objects for a resource.

Kind: global function
Returns: Array - an array of objects

| Param | Type | Description | | --- | --- | --- | | context | Object | the context for the request | | appId | Number | the pay application id | | resource | String | the pay resource | | callback | function | the callback |

get(context, appId, resource, callback) ⇒ Object

Get an object given a resource.

Kind: global function
Returns: Object - an object

| Param | Type | Description | | --- | --- | --- | | context | Object | the context for the request | | appId | Number | the pay application id | | resource | String | the pay resource | | callback | function | the callback |

post(context, appId, resource, object, callback) ⇒ Object

Create an object at a resource.

Kind: global function
Returns: Object - the created object

| Param | Type | Description | | --- | --- | --- | | context | Object | the context for the request | | appId | Number | the pay application id | | resource | String | the pay resource | | object | Object | the object to create | | callback | function | the callback |

put(context, appId, resource, object, callback) ⇒ Object

Update an object at a resource.

Kind: global function
Returns: Object - the updated object

| Param | Type | Description | | --- | --- | --- | | context | Object | the context for the request | | appId | Number | the pay application id | | resource | String | the pay resource | | object | Object | the updated object | | callback | function | the callback |

del(context, appId, resource, callback) ⇒ Object

Remove an object at a resource.

Kind: global function
Returns: Object - the removed object

| Param | Type | Description | | --- | --- | --- | | context | Object | the context for the request | | appId | Number | the pay application id | | resource | String | the pay resource | | callback | function | the callback |