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

ghost-payments

v1.0.0

Published

api to interact with the ghost payment system

Downloads

5

Readme

Ghost Analytics node.js client

Installation

npm install ghost-analytics-client

Documentation

Documentation is not yet available.

API Overview

Every resource is accessed via your ghost-analytics-client instance:

const GhostAnalytics = require('ghost-analytics-client')({ publicKey: ' your public key ', secretKey: ' your secret key ' });
// GhostAnalytics.{ RESOURCE_NAME }.{ METHOD_NAME }

Every resource method returns a promise (bluebird):

GhostAnalytics.customer.create({ email: '[email protected]' })
.then(customer => { //...do stuff })
.catch(err => { //...handle error });

Notes

Where you see params it is a plain JavaScript object, e.g. { email: '[email protected]' } For requests that return a single item, the item will be contained inside of the doc property in the response body. For requests that return multiple items, the items will be contained inside of the docs property in the response body. For requests that delete an item, the response body will contain { success: true }.

[Account]

| Endpoint | Description | | ---- | --------------- | | [GET /api/v1/accounts/{accountId}] | Get an account|

GET /api/v1/accounts/{accountId}

Returns an account object.

Example Request

GhostAnalytics.account.get({ accountId: 1 })
.then(account => { //...do stuff })
.catch(err => { //...handle error });

Example Response

{
  "doc": {
    // the account object
  }
}

[Charge]

| Endpoint | Description | | ---- | --------------- | | [POST /api/v1/charges] | Create a charge|

POST /api/v1/charges

Creates and returns a charge object.

Example Request

GhostAnalytics.charge.create({ 
  amount: 1000, // in cents
  cardId: card_somecardid,
  customerId: customer_somecustomerid,
  description: 'some charge description',
})
.then(charge => { //...do stuff })
.catch(err => { //...handle error });

Example Response

{
  "doc": {
    // the charge object
  }
}

[CustomerCard]

| Endpoint | Description | | ---- | --------------- | | [GET /api/v1/customers/{customerId}/cards/{cardId}] | Get a customer card| | [POST /api/v1/customers//{customerId}] | Create a customer card| | [DELETE /api/v1/customers/{customerId}/cards/{cardId}] | Delete a customer card|

GET /api/v1/customers/{customerId}/cards/{cardId}

Returns a customer card object.

Example Request

GhostAnalytics.customerCard.get({ 
  cardId: card_somecardid,
  customerId: customer_somecustomerid
})
.then(card => { //...do stuff })
.catch(err => { //...handle error });

Example Response

{
  "doc": {
    // the card object
  }
}

POST /api/v1/customers/{customerId}/cards

Creates and returns a customer card object.

Example Request

GhostAnalytics.customerCard.get({
  number: 4242424242424242,
  expMonth: '02',
  expYear: '2018',
  cvc: 123
  customerId: customer_somecustomerid
})
.then(card => { //...do stuff })
.catch(err => { //...handle error });

Example Response

{
  "doc": {
    // the card object
  }
}

DELETE /api/v1/customers/{customerId}/cards/{cardId}

Deletes a customer card object.

Example Request

GhostAnalytics.customerCard.delete({
  cardId: card_somecardid
  customerId: customer_somecustomerid
})
.then(success => { //...do stuff })
.catch(err => { //...handle error });

Example Response

{
  "success": true
}

[Customer]

| Endpoint | Description | | ---- | --------------- | | [GET /api/v1/customers/:customerId] | Get a customer| | [POST /api/v1/customers] | Create a customer| | [PUT /api/v1/customers/:customerId] | Update a customer| | [DELETE /api/v1/customers/:customerId] | Delete a customer|

GET /api/v1/customers/{customerId}

Returns a customer card object.

Example Request

GhostAnalytics.customer.get({ 
  customerId: customer_somecustomerid
})
.then(customer => { //...do stuff })
.catch(err => { //...handle error });

Example Response

{
  "doc": {
    // the customer object
  }
}

POST /api/v1/customers

Creates and returns a customer card object.

Example Request

GhostAnalytics.customerCard.get({
  description: 'some customer description'
})
.then(customer => { //...do stuff })
.catch(err => { //...handle error });

Example Response

{
  "doc": {
    // the customer object
  }
}

PUT /api/v1/customers/{customerId}

Updates and returns a customer card object.

Example Request

GhostAnalytics.customerCard.update({
  customerId: customer_somecustomerid,
  description: 'some new customer description'
})
.then(customer => { //...do stuff })
.catch(err => { //...handle error });

Example Response

{
  "doc": {
    // the customer object
  }
}

DELETE /api/v1/customers/{customerId}

Deletes a customer object.

Example Request

GhostAnalytics.customer.delete({
  customerId: customer_somecustomerid
})
.then(success => { //...do stuff })
.catch(err => { //...handle error });

Example Response

{
  "success": true
}

Errors

All error responses are in the following format, delivered with the corresponding status code:

{
    "message":"Invalid id",
    "status":400,
    "error":"Bad Request"
}