Skip to content

Latest commit

 

History

History
73 lines (56 loc) · 1.81 KB

README.md

File metadata and controls

73 lines (56 loc) · 1.81 KB

Amazon-GC

API client for using Amazon Incentives API to create gift cards on demand.

A fork of @john9hoff's amazon-gc.

Install

npm install --save amazon-gc-se

Usage

Create a gift card

const { createGiftCard } = require('amazon-gc-se')

const request = {
    amount: 20,
    currencyCode: 'USD',
    partnerId: 'yourPartnerId',
    accessKey: 'yourAccessKey',
    secretKey: 'yourSecretKey',
    environment: 'sandbox',
    endpoint: 'NA',
}

async function runSample() {
    const res = await createGiftCard(request);
    console.log(`Amazon gift card is ${JSON.stringify(res)}`)
}

runSample().catch(console.error)

Regenerate gift card

const { createGiftCard } = require('amazon-gc-se')

const request = {
    amount: 20,
    currencyCode: 'USD',
    partnerId: 'yourPartnerId',
    accessKey: 'yourAccessKey',
    secretKey: 'yourSecretKey',
    environment: 'sandbox',
    endpoint: 'NA',
    creationRequestId: 'previouslyGeneratedCreationRequestId',
}

async function runSample() {
    const res = await createGiftCard(request);
    console.log(`Amazon gift card is ${JSON.stringify(res)}`)
}

runSample().catch(console.error)

Changes

  • Added type declaration
  • Removed unused dependencies
  • Updated every dependencies
  • Replaced @dylang/shortid with @ai/nanoid
  • Regenerate coupons by passing creationRequestId to createGiftCard

Other clients

Problems