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

keepin-amazon-payments

v1.0.0

Published

API wrapper for Amazon Payments

Downloads

6

Readme

Installation:

npm install keepin-amazon-payments

Usage:

Initialize the amazonPayment object with the environment variable, and all required config parameters.

The amazonPayments.Environment object contains two properties: Production and Sandbox, pass one of these in the configuration object. Use ProductionEU and SandboxEU for European countries.

Example:

var amazonPayments = require('keepin-amazon-payments');
var payment = amazonPayments.connect({
  environment: amazonPayments.Environment.Production,
  sellerId: 'Amazon Seller ID',
  mwsAccessKey: 'MWS Access Key',
  mwsSecretKey: 'MWS Secret Key',
  clientId: 'Client ID'
});

Note about request parameters

This module will automatically sign all requests and convert nested objects to dot notation.

Example:

payment.offAmazonPayments.refund({
  AmazonCaptureId: 'Amazon capture ID',
  RefundReferenceId: 'Refund Reference ID',
  RefundAmount: {
    Amount: 123.45,
    CurrencyCode: 'USD'
  }
}, function(err) {
  console.log(err);
})

Will make a call with the following parameters:

{
  "AmazonCaptureId": "Amazon capture ID",
  "RefundReferenceId": "Refund Reference ID",
  "RefundAmount.Amount": 123.45,
  "RefundAmount.CurrencyCode": "USD"
}

api.getTokenInfo(accessToken, callback)

getTokenInfo takes two parameters: accesToken and callback. More Info

callback: err, tokenInfo

Example:

payment.api.getTokenInfo('access token from button', function(err, tokenInfo) {
  console.log(tokenInfo);
});

api.getProfile(accessToken, callback)

getProfile takes two parameters: accesToken and callback. More Info

callback: err, profile

Example:

payment.api.getProfile('access token from button', function(err, profile) {
  console.log(profile);
});

offAmazonPayments.*

All the methods in the offAmazonPayments object take two parameters: params and callback. The functions are all named the same as their respective API calls, except with a lowercase first letter. More Info

Exmaple:

payment.offAmazonPayments.getAuthorizationDetails({
  AmazonAuthorizationId: 'P01-0000000-0000000-000000'
}, function(err, details) {
  // details will be the authorization details
});

SNS Response handling

Version 0.1.2 added SNS response handling for dealing with SNS messages. This also includes support for IPN endpoints. This will check the signature and attempt to parse any XML within IPN requests, if the message is not JSON it will return the raw message data, otherwise it will be the parsed response.

Example:

payment.parseSNSResponse(responseFromSns, function(err, parsed) {
  // parsed will contain the full response from SNS unless the message is an IPN notification, in which case it will be the JSON-ified XML from the message.
});