Our US based ecommerce seller wanted to integrate thier back-office to download Orders from Amazon automatically and storing it in thier database.oo
For the uninitiated, below is the basic selling process for a third-party seller on Amazon:
- Our client loads inventory and product information onto their Amazon storefront.
- Customers purchase products from the seller on Amazon.
- Our client sync orders from Amazon every 30 minutes.
- Application validate the orders and save it in database.
- Client fulfill the orders and send Shipment notification to Amazon.
In this blog series, we will walk through the recent Amazon MWS integration we performed, detailing the pitfalls we encountered and how we handled them.
For this blog series, we assume that you already know about the Amazon Data Protection policy, if not you can walk through our earlier post on Amazon Data Protection policy.
Before we get started, please take a look at the MWS documentation for Order Feeds for available actions.
Since the client back-office was developed using Java, so we decided to Java library provided by Amazon for each of their endpoints.
The detailed working of the above flowchart:
- Polling Amazon every 30 minustes for Orders with some parameters like Created Date after, Order Status.
- Amazon respond with list of Orders, if any in XML format.
- Parsing and storing Orders in customer database.
- When polling the ListOrders action, the response contains a field called NextToken, which if not empty will be used to poll ListOrdersByNextToken for the remaining orders. However, if a NextTokenCorrupted error occurs, the entire chain of calls to ListOrders and ListOrdersByNextToken will need to be repeated to retrieve the remaining orders.