Skip to content

Repository files navigation

@bizon/amazon-ids

npm version codecov XO code style

Collection of Amazon identifiers

Bizon

CI

Tests Release

Getting started

npm install --save @bizon/amazon-ids

API

All three lookup functions are overloaded: passing a known literal (or a value typed with one of the unions below) returns a Marketplace, while passing an arbitrary string returns Marketplace | undefined.

import {getMarketplaceByCode, type MarketplaceCode} from '@bizon/amazon-ids'

getMarketplaceByCode('fr').domain // Marketplace — no optional chaining needed
getMarketplaceByCode(someString)?.domain // Marketplace | undefined

The exported unions are MarketplaceCode, MarketplaceId, MarketplaceRegion and MarketplaceDomain. MarketplaceCode and MarketplaceDomain only cover the marketplaces served by an Amazon storefront — the multi-channel (*-non-amazon), invoicing and Amazon Pay entries have no domain, so their codes are not part of the union and looking them up returns Marketplace | undefined.

marketplaces

import {marketplaces} from '@bizon/amazon-ids'

for (const marketplace of marketplaces) {
  // console.log(marketplace)
}

getMarketplaceById(id)

import {getMarketplaceById} from '@bizon/amazon-ids'

getMarketplaceById('ATVPDKIKX0DER')

/*
{
  code: 'us',
  id: 'ATVPDKIKX0DER',
  name: 'United States',
  region: 'na',
  domain: 'amazon.com',
  advertisingApiDomain: 'advertising-api.amazon.com',
  imagesDomain: 'images-na.ssl-images-amazon.com',
  vendorId: 'ATVPDKIKX0DER',
  sellerCentralDomain: 'sellercentral.amazon.com',
  vendorCentralDomain: 'vendorcentral.amazon.com',
  currencyCode: 'USD'
}
*/

It’s also possible to find multi-channel marketplaces:

getMarketplaceById('A2ZV50J4W1RKNI')

/*
{
  code: 'us-non-amazon',
  id: 'A2ZV50J4W1RKNI',
  name: 'United States - Non-Amazon',
  region: 'na',
  currencyCode: 'USD'
}
*/

getMarketplaceByCode(code)

import {getMarketplaceByCode} from '@bizon/amazon-ids'

getMarketplaceByCode('DE')

/*
{
  code: 'de',
  id: 'A1PA6795UKMFR9',
  name: 'Germany',
  region: 'eu',
  domain: 'amazon.de',
  advertisingApiDomain: 'advertising-api-eu.amazon.com',
  imagesDomain: 'images-eu.ssl-images-amazon.com',
  vendorId: 'A3JWKAKR8XB7XF',
  sellerCentralDomain: 'sellercentral-europe.amazon.com',
  vendorCentralDomain: 'vendorcentral.amazon.de',
  currencyCode: 'EUR'
}
*/

getMarketplaceByDomain(domain)

import {getMarketplaceByDomain} from '@bizon/amazon-ids'

getMarketplaceByDomain('Amazon.com.mx')

/*
{
  code: 'mx',
  id: 'A1AM78C64UM0Y8',
  name: 'Mexico',
  region: 'na',
  domain: 'amazon.com.mx',
  imagesDomain: 'images-na.ssl-images-amazon.com',
  vendorId: 'AVDBXBAVVSXLQ',
  sellerCentralDomain: 'sellercentral.amazon.com.mx',
  vendorCentralDomain: 'vendorcentral.amazon.com.mx',
  currencyCode: 'MXN'
}
*/

License

MIT

Miscellaneous

    ╚⊙ ⊙╝
  ╚═(███)═╝
 ╚═(███)═╝
╚═(███)═╝
 ╚═(███)═╝
  ╚═(███)═╝
   ╚═(███)═╝

Releases

Packages

Used by

Contributors

Languages