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

amazon-costs

v1.0.2

Published

A module for retrieving Amazon product information and calculating costs for fulfillment and merchant channels

Downloads

20

Readme

Amazon Costs

NPM Build Status

Amazon Costs is a module for retrieving Amazon product information and calculating costs for fulfillment and merchant channels.

Installation

npm install amazon-costs

Usage

Search

var amzCosts = require('amazon-costs');

amzCosts.productSearch('The Hobbit DVD', function(err, data) {
  if(!err) {
    console.log(data);
  } else {
    console.log(err);
  }
});

// Output
/*
{ items:
   [ { link: 'http://www.amazon.com/gp/product/B00BEZTMFY/ref=xx_xx_cont_xx/176-0515210-4045758',
       dimUnits: 'inches',
       thumbnail: 'https://images-na.ssl-images-amazon.com/images/I/51oyx9TCjVL._SL80_.jpg',
       subCategory: null,
       dimensions: [Object],
       gl: 'gl_dvd',
       image: 'https://images-na.ssl-images-amazon.com/images/I/51oyx9TCjVL._SL120_.jpg',
       weightUnits: 'pounds',
       productGroup: '74',
       weight: 0.2,
       asin: 'B00BEZTMFY',
       whiteGlovesRequired: 'N',
       title: 'The Hobbit: An Unexpected Journey (Two-Disc Special Edition) (DVD + UltraViolet Digital Copy) [DVD]' },
     { link: 'http://www.amazon.com/gp/product/B00HWWUQWQ/ref=xx_xx_cont_xx/176-0515210-4045758',
       dimUnits: 'inches',
       thumbnail: 'https://images-na.ssl-images-amazon.com/images/I/51AcQosPxyL._SL80_.jpg',
       subCategory: null,
       dimensions: [Object],
       gl: 'gl_dvd',
       image: 'https://images-na.ssl-images-amazon.com/images/I/51AcQosPxyL._SL120_.jpg',
       weightUnits: 'pounds',
       productGroup: '74',
       weight: 0.1,
       asin: 'B00HWWUQWQ',
       whiteGlovesRequired: 'N',
       title: 'The Hobbit: The Desolation of Smaug (Special Edition) (DVD + UltraViolet Combo Pack) [DVD]' } ],
  errors: null }
*/

Cost

var amzCosts  = require('amazon-costs');
var asin      = 'B00BEZTMQ8';

amzCosts.productSearch(asin, function(err, data) {
  if(err) {
    console.log(err);
    return;
  }

  console.log(data);

  if(!data || !(data.items instanceof Array) || data.items[0] && data.items[0].asin != asin) {
    console.log("Error: Product (" + asin + ") could not be found.");
    return;
  }

  // FBA costs
  amzCosts.productCosts({
    product: data.items[0],
    cost: {
      costType: 'FBA',
      productPrice: 25.00,
      inboundDelivery: 1.00,
      prepService: 1.00
    }
  }, function(err, data) {
    if(!err) {
      console.log(JSON.stringify(data, null, 2));
    } else {
      console.log(err);
    }
  });

  // FBM costs
  amzCosts.productCosts({
    product: data.items[0],
    cost: {
      costType: 'FBM',
      productPrice: 25.00,
      shipping: 1.00,
      orderHandling: 1.00,
      pickPack: 1.00,
      outboundDelivery: 1.00,
      storage: 1.00,
      inboundDelivery: 1.00,
      customerService: 1.00,
      prepService: 1.00
    }
  }, function(err, data) {
    if(!err) {
      console.log(JSON.stringify(data, null, 2));
    } else {
      console.log(err);
    }
  });
});

// Output
/*
{ items:
   [ { link: 'http://www.amazon.com/gp/product/B00BEZTMQ8/ref=xx_xx_cont_xx/186-8065886-6900841',
       dimUnits: 'inches',
       thumbnail: 'https://images-na.ssl-images-amazon.com/images/I/51nZpnQgUwL._SL80_.jpg',
       subCategory: null,
       dimensions: [Object],
       gl: 'gl_dvd',
       image: 'https://images-na.ssl-images-amazon.com/images/I/51nZpnQgUwL._SL120_.jpg',
       weightUnits: 'pounds',
       productGroup: '74',
       weight: 0.1,
       asin: 'B00BEZTMQ8',
       whiteGlovesRequired: 'N',
       title: 'The Hobbit: An Unexpected Journey (Blu-ray) [Blu-ray]' } ],
  errors: null }
{
  "items": [
    {
      "asin": "B00BEZTMQ8",
      "cost": {
        "merchant": {
          "price": 25,
          "revenueTotal": 25,
          "inbound-delivery": 1,
          "prep-service": 1,
          "fulfillmentTotal": 2
        },
        "amazon": {
          "weightHandlingFee": "0.46",
          "orderHandlingFee": 0,
          "fbaDeliveryServicesFee": 0,
          "commissionFee": "3.75",
          "pickAndPackFee": "1.02",
          "storageFee": 0,
          "variableClosingFee": "0.8"
        }
      }
    }
  ],
  "errors": null
}
{
  "items": [
    {
      "asin": "B00BEZTMQ8",
      "cost": {
        "merchant": {
          "price": 25,
          "shipping": 1,
          "order-handling": 1,
          "pick-pack": 1,
          "outbound-delivery": 1,
          "storage": 1,
          "inbound-delivery": 1,
          "customer-service": 1,
          "prep-service": 1,
          "revenueTotal": 26,
          "fulfillmentTotal": 7
        },
        "amazon": {
          "commissionFee": 3.75,
          "variableClosingFee": "1.35"
        }
      }
    }
  ],
  "errors": null
}
*/

License

Licensed under The MIT License (MIT)
For the full copyright and license information, please view the LICENSE.txt file.