amazon-incentives-api
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Amazon Incentives API for Node.js

All Contributors

Version License: MIT

Amazon Incentives API for Node.js to provide a type-safe interface to create and cancel Amazon digital gift cards. Built with TypeScript, it ensures reliability and seamless integration for your projects. Suitable for both sandbox and production environments.

Installation

npm install amazon-incentives-api

Usage

For a comprehensive guide on gift card operations, visit Amazon's Developer Portal.

Initialization

import {IncentivesAPI} from 'amazon-incentives-api';

const client = new IncentivesAPI({
  accessKeyId: 'YOUR_ACCESS_KEY_ID',
  secretAccessKey: 'YOUR_SECRET_ACCESS_KEY',
  partnerId: 'YOUR_PARTNER_ID',
  endpoint: IncentivesAPI.Endpoint.JapanSandbox, // Or any other endpoint as needed
});

Creating a Gift Card

For gift card creation, you need a unique creationRequestId starting with your partnerId and not exceeding 40 characters. Specify the gift card amount and currency code as well.

const creationRequestResponse = await client.createGiftCard({
  creationRequestId: 'YOUR_UNIQUE_REQUEST_ID',
  amount: 100,
  currencyCode: 'JPY',
});

console.log(creationRequestResponse);

Canceling a Gift Card

Gift cards can be canceled as long as they remain unclaimed by an Amazon customer. Note that this operation is only possible within 15 minutes of the creation request timestamp.

const cancelRequestResponse = await client.cancelGiftCard(
  'YOUR_UNIQUE_REQUEST_ID'
);
console.log(cancelRequestResponse);

Getting Available Funds

You can get the available funds in your Amazon Incentives account.

const availableFundsResponse = await client.getAvailableFunds();

console.log(availableFundsResponse);

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Santa Takahashi
Santa Takahashi

💻
Kenta Shimizu
Kenta Shimizu

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

/amazon-incentives-api/

    Package Sidebar

    Install

    npm i amazon-incentives-api

    Weekly Downloads

    14

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    18.3 kB

    Total Files

    6

    Last publish

    Collaborators

    • santat