Socket
Socket
Sign inDemoInstall

amazon-pay-async

Package Overview
Dependencies
54
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    amazon-pay-async

API wrapper for Amazon Pay using promises and defining types


Version published
Weekly downloads
29
increased by3.57%
Maintainers
1
Install size
6.07 MB
Created
Weekly downloads
 

Readme

Source

Installation:

NPM

npm i amazon-pay-async

Description:

API wrapper for Amazon Pay using promises and offer defined types for Typescript moduls.

Usage:

Instantiate an amazonPayment instance with the environment variable, and all required config parameters.

The AmazonPayClient class has a public, static property called Environments which is an enum containing four properties: Production and Sandbox, pass one of these in the configuration object. Use ProductionEU and SandboxEU for European countries.

Example:

import AmazonPayClient from 'amazon-pay-async';
var client = new AmazonPayClient({
  clientId: 'Client ID'
  mwsAccessKey: 'MWS Access Key',
  mwsSecretKey: 'MWS Secret Key',
  sellerId: 'Amazon Seller ID',
  environment: AmazonPayClient.Environments.Production,
});

Note about request parameters

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

Example:

await client.offAmazonPayments.refund({
  AmazonCaptureId: 'Amazon capture ID',
  RefundReferenceId: 'Refund Reference ID',
  RefundAmount: {
    Amount: 123.45,
    CurrencyCode: 'USD'
  }
})

Will make a call with the following parameters:

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

API documentation

As the module offers pre-defined types for Typescript modules, here's a TS example:

Example:

import { IRefundRequest, IRefundResponse } from 'amazon-pay-async';
const refundResponse: IRefundResponse = await client.offAmazonPayments.refund({
  AmazonCaptureId: 'Amazon capture ID',
  RefundReferenceId: 'Refund Reference ID',
  RefundAmount: {
    Amount: 123.45,
    CurrencyCode: 'USD'
  }
} as IRefundRequest);

Note:

This is a mirrored version of the https://github.com/MadisonReed/amazon-payments package. For any usage information regarding version 0.x please refer for the original package.

Keywords

FAQs

Last updated on 12 Feb 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc