Amazon Seller Central Integrated via SP-APIs in Node.js

Amazon Seller Central is the interface Third Party sellers use to get the list and sell products directly to Amazon’s customers. An Amazon Seller Central account is considered a marketplace or third-party Amazon seller (3P).

The Selling Partner API (SP-API) is now available for all registered developers worldwide. SP-API is the next-generation suite of API-based automation functionality for Amazon’s selling partners and the evolution of Amazon Marketplace Web Service (Amazon MWS). Going forward, all new API functionality will be built in SP-API, with updates to Amazon MWS.

The Selling Partner API is a REST-based API that helps Amazon sellers programmatically access their data on listings, orders, payments, reports, and more.

In short for the developers, SP-API is the new version for seller central, as earlier Amazon MWS API was/is to use, MWS is still in use but SP-API is more beneficial and secure than MWS APIs with new features.

Let's get started for the development process to access SP-APIs:

To retrieve Amazon seller central any data in your application(project), there are certain and important steps.

These SP-APIs are provided in libraries as per backend servers node.js, java, .net, python, etc.
You can go through this below link for all the SP-APIs(operations) provided by Amazon seller central (SP-APIS).
https://github.com/amzn/selling-partner-api-docs/tree/main/references

I have implemented this operation in node.js as per the client’s requirement.

Step 1: Create an AWS account
Step 2: Create an IAM user
Step 3: Create an IAM policy
Step 4: Create an IAM role
Step 5: Add an AWS Security Token Service policy to your IAM user
Step 6: Register your application

To accomplish these steps go through the links attach to the title of steps.
The important point mentioned in the 6th step is that attach IAM ARN to the application created in the seller central while registering. And after creating your application, you will receive mail of approval of application, as it reviews strictly.

Amazon Seller Central is not a free account.

So the above points were to create, link, attach AWS account and Amazon Seller Central.

To get the SP-APIs data access most important point is the configuration.
To configure seller central in node.js, four keys are important.

SELLING_PARTNER_APP_CLIENT_ID: <APP_CLIENT_ID>
SELLING_PARTNER_APP_CLIENT_SECRET:
<APP_CLIENT_SECRET>
AWS_ACCESS_KEY_ID:
<AWS_USER_ID>
AWS_SECRET_ACCESS_KEY:
<AWS_USER_SECRET>
AWS_SELLING_PARTNER_ROLE: <AWS_SP_API_ROLE>

The First 2 keys, you will get in the created developer application in the seller central account, in the Apps & Services menu, click Develop Apps.
The last 3 keys, you will get in your AWS account of IAM user.

Create Nodejs application.
Install the package:
npm i amazon-sp-api

Go through the documentation of this package & understand the library dependencies.

Import package:

const SellingPartnerAPI = require(‘amazon-sp-api’);

Create client and call API:

An instance of configuration.
let sellingPartner =
new SellingPartnerAPI({
region: <The region of the selling partner API endpoint (“eu”, “na” or “fe”)>
refresh_token: <The refresh token of your app user>
credentials: <JSON of above 4 major keys>
});
“eu”, “na” or “fe” =>Europe, North America, Far east

A simple example of one API/operation:-

Synchronous concept is requires here, there is no any callback function.

let manageInventoryData = await sellingPartner.callAPI({
operation: 'getInventorySummaries',
query: {
details: true,
granularityType: 'Marketplace',
marketplaceIds: marketplaceId
}
});

Operation ‘getInventorySummaries’ is an SP-API which is called internally via this package, you will all the products with all details as ASIN, SKU, PRODUCT NAME, and more.

There are SP-APIs related to FBA-inventory, authorization, finances, inbound/outbound, merchant fulfillment, orders, products, shipping, uploading, downloading, and many more.

This implementation will optimize your time.

If you want to use both, SP-APIs and MWS APIS then you have to create Hybrid Selling Partner API applications.

My suggestion will be to use SP-APIs.

The main reason to do this application in Nodejs was to reduce the time of the client.

As the client is doing their all calculations and other verification manually, in short copy the text from seller central and paste it in google sheet.

Now it's automated.
Now I can retrieve data from Amazon seller central via SP-APIs and update in google drive sheet via Google APIs.

I was interested to share my experience of google sheet API on medium, but it’s simple, you can refer to this Nodejs package https://www.npmjs.com/package/googleapis

Medium on Google sheet APIs by me on 10th June 2021

I hope, using this story, you may get the idea to implement amazon SP-API in Nodejs.

(Full Stack Developer) CoReCo Technologies