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

snipcart-api

v0.0.9

Published

implementation of the snipcart api

Downloads

4

Readme

node-snipcart-api

implementation of the snipcart api

npm version

Install

npm i --save snipcart-api

Configuration

The api requires a Secret API Key. This can be set by using an environment variable SECRET_API_KEY

OR

const snipcart = require('snipcart-api');
snipcart.configure('SECRET_API_KEY', SECRET_API_KEY);

Making API Calls

Once the Secret API Key is set, you may go ahead and make api calls

Implemented Methods

api.orders.getAll
api.orders.getOne
api.orders.update

api.discounts.getAll
api.discounts.getOne
api.discounts.update
api.discounts.create

api.subscriptions.getAll
api.subscriptions.getOne
api.subscriptions.invoices
api.subscriptions.pause
api.subscriptions.resume
api.subscriptions.cancel

api.notifications.getAll
api.notifications.create

api.refunds.getAll
api.refunds.getOne
api.refunds.create

api.customers.getAll
api.customers.getOne
api.customers.orders

api.userSessions.getOne

api.products.getAll
api.products.getOne
api.products.create
api.products.update

api.abandonedCarts.getAll
api.abandonedCarts.getOne

api.domains.getDefaultDomain
api.domains.updateDefaultDomain
api.domains.getAllowedDomains
api.domains.createAllowedDomains
api.domains.deleteAllowedDomains

api.shippingMethods.getAll
api.shippingMethods.getOne
api.shippingMethods.update
api.shippingMethods.deleteOne
api.shippingMethods.create

All Methods accept a single param (options {Object}).

Request Options

|Property|Description| |:--|:--| |urlParams {Object}| Holds keys that may replace url paramaters that may need an id or token for eg. {id: '1234'} To know which methods need url parameters please view the api definition| |params {Object}|This is an object map of all query parameters that you wish to send with the request for eg. {limit:50, offset:0, status:'Active'}| |data {Object}| the body of the request, usually used for PUT and POST requests|

eg.

const snipcart = require('snipcart-api');
snipcart.api.refunds
    .getOne({
        urlParams: {
            id: '2223490d-84c1-480c-b713-50cb0b819313',
            token: '4243490d-87c1-480e-b413-51db0b419313',
        }
    })
    .then((response) => {
        console.log('success');
        console.log(response.data);
        console.log(response.status);
        console.log(response.statusText);
        console.log(response.headers);
        console.log(response.config);
    })
    .catch((error) => {
        if (error.response) {
            // The request was made and the server responded with a status code
            // that falls out of the range of 2xx
            console.log(error.response.data);
            console.log(error.response.status);
            console.log(error.response.headers);
            console.error('Error', error.message);
        }
    });

Notes

  • Pull requests are welcome.