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

recharge-api-node

v1.1.4

Published

Recharge API bindings for Node.js

Downloads

1,653

Readme

Recharge API Node.js

Recharge API bindings for Node.js

Installation:

$ npm install --save recharge-api-node

API

This module exports a constructor function which takes an options object.

Recharge(options)

Creates a new Recharge instance.

Arguments

  • options - Required - A plain JavaScript object that contains the configuration options.

Options

  • apiKey - Required - A string that specifies the API key of the app.
  • secrete - A string that specifies the secrete of the app.
  • autoLimit - Optional - This option allows you to regulate the request rate in order to avoid hitting the [rate limit][api-call-limit]. Requests are limited using the token bucket algorithm. Accepted values are a boolean or a plain JavaScript object. When using an object, the calls property and the interval property specify the refill rate and the bucketSize property the bucket size. For example { calls: 2, interval: 1000, bucketSize: 35 } specifies a limit of 2 requests per second with a burst of 35 requests. When set to true requests are limited as specified in the above example. Defaults to false. presentment prices for products. Defaults to false.
  • timeout - Optional - The number of milliseconds before the request times out. If the request takes longer than timeout, it will be aborted. Defaults to 60000, or 1 minute.

Return value

A Recharge instance.

Exceptions

Throws an Error exception if the required options are missing.

Example

const Recharge = require('recharge-api-node');

const recharge = new Recharge({
  apiKey: 'your-api-key',
  secrete: 'your-app-secrete'
});

Resources

Every resource is accessed via your recharge instance:

const recharge = new Recharge({
  apiKey: 'your-api-key',
  secrete: 'your-app-secrete'
});

// recharge.<resource_name>.<method_name>

Each method returns a Promise that resolves with the result:

recharge.subscription
  .list({ limit: 5 })
  .then((subscriptions) => console.log(subscriptions))
  .catch((err) => console.error(err));

Available resources and methods

  • address
    • count()
    • list([params])
    • get(id[, params])
    • update(id, params)
    • delete(id)
    • validate(params)
    • addDiscount(id, params)
    • removeDiscount(id, params)
    • addOneTimeProduct(id, params)
  • asyncBatch
    • list([params])
    • get(id[, params])
    • create(params)
    • addTasks(batch_id, params)
    • tasks(batch_id)
    • process(batch_id)
  • charge
    • count()
    • list([params])
    • get(id[, params])
    • create(params)
    • update(id, params)
    • delete(id)
    • changeNextChargeDate(id, params)
    • skip(id, params)
    • unskip(id, params)
    • refund(id, params)
    • addDiscount(id, params)
    • removeDiscount(id, params)
  • checkout - BETA - **query_params object can be used in case of partial_shipping ex: {partial_shipping: 1}
    • get(checkout_token[, params])
    • create(params[, query_params])
    • update(checkout_token, params[, query_params])
    • getShippingRates(checkout_token)
    • process(checkout_token, params)
  • collection
    • count()
    • list([params])
    • get(id[, params])
  • customerAddress
    • list(customer_id[, params])
    • create(customer_id, params)
  • customer
    • count()
    • list([params])
    • get(id[, params])
    • create(params)
    • update(id, params)
    • delete(id)
    • getPaymentSources(id)
  • discount
    • count()
    • list([params])
    • get(id[, params])
    • create(params)
    • update(id, params)
    • delete(id)
    • addToAddress(address_id[, params])
    • removeFromAddress(address_id[, params])
    • addToCharge(charge_id[, params])
    • removeFromCharge(charge_id[, params])
  • metafield
    • count()
    • list([params])
    • get(id[, params])
    • create(params)
    • update(id, params)
    • delete(id)
  • oneTime
    • list([params])
    • get(id[, params])
    • create(address_id, params)
    • update(id, params)
    • delete(id)
  • order
    • count()
    • list([params])
    • get(id[, params])
    • create(params)
    • update(id, params)
    • delete(id)
    • changeShippingDate(id, params)
    • changeOrderVariant(id, shopify_variant_id, params)
    • clone(id, charge_id, params)
  • product
    • count()
    • list([params])
    • get(id[, params])
  • shop
    • get()
    • getShippingCountries()
  • subscription
    • count()
    • list([params])
    • get(id[, params])
    • create(params)
    • update(id, params)
    • delete(id)
    • changeNextChargeDate(id, params)
    • changeAddress(id, params)
    • cancel(id, params)
    • activate(id)
    • ** 'swap product' end point can be triggered using 'update()' function
  • webhook
    • count()
    • list([params])
    • get(id[, params])
    • create(params)
    • update(id, params)
    • delete(id)
    • validate(request_body, secrete)

where params is a plain JavaScript object. See https://developer.rechargepayments.com/#webhooks for parameters details.