Tutorial: Fetching stock data from Amazon using FBAInventoryServiceMWS

First thing you need is PHP client for Fulfillment Inventory API, you can download at https://developer.amazonservices.ca/doc/fba/inventory/v20101001/php.html – yes, version is 4 years old, they don’t have any newer… Unpack zip at you library folder and you should see such files:

Zrzut ekranu 2014-10-18 o 12.24.22

Next step is preparing config, all you need is below:

Just fill in proper values. Then setup autoloader for your client (if you have it already done for other libraries, just skip this step):

Then invoke client itself:

Variable $serviceUrl depends on your region:

North America – https://mws.amazonservices.com/FulfillmentInventory/2010-10-01
Europe – https://mws-eu.amazonservices.com/FulfillmentInventory/2010-10-01
Japan – https://mws.amazonservices.jp/FulfillmentInventory/2010-10-01
China – https://mws.amazonservices.com.cn/FulfillmentInventory/2010-10-01

Next step is preparing request itself, you need to use product SKU:

And the final step is calling webservice:

The strange thing is that even with proper response (without any errors, Amazon throws exception, maybe there is some config entry for this, have no idea. Anyway in $code variable you should have HTTP reponse code, if this is 200 then everything went ok, returned XML should look like:

Now all you need is to update your DB with proper values.

Leave a Reply