Ecommerce Developer

Access Orders with the Amazon Marketplace API

Ecommerce giant Amazon allows other retailers to sell products on its site via the Amazon Marketplace. While this can be a good source of additional sales, it creates a separate order fulfillment workflow.

Thanks to the Amazon Marketplace Web Service (MWS), developers can help, retrieving order information automatically from Amazon and then inserting the retrieved Marketplace orders into a merchant’s ecommerce platform.

An example may help to demonstrate the need. Imagine a retailer who sells products via a Magento-powered website as well as on the Amazon Marketplace. When orders come into Magento, they are queued for processing in the site’s administration panel.

Orders from the Amazon Marketplace have a separate workflow. An administrator receives an email announcing the order and must follow a link to the Amazon Seller Central site where a packing slip may be printed. Once the order is packed and shipped, the seller must return to Amazon to submit the shipping information.

A far better solution would be to have a script that automatically retrieved the new Amazon Marketplace orders and added them to the merchant’s existing platform.

This article describes how to use Amazon’s MWS to get order information with a script.

Download the MWS Library

To use Amazon MWS, a developer must be registered and the merchant must have a valid Amazon seller account.

The first step toward programmatically accessing Amazon marketplace orders is to download the Orders Client Library, which is available for PHP, C#, and Java. For this article, I used the PHP library.

Including Required Libraries

Amazon includes a “Samples” folder in the Client Library. Inside is a sample configuration file that is very helpful. This sample file is shown below. Amazon’s comments make the code fairly easy to understand.

  1. <?php
  2.  
  3.    /********
  4.     * REQUIRED
  5.     *
  6.     * Access Key ID and Secret Acess Key ID, obtained from:
  7.     * http://aws.amazon.com
  8.     *********/
  9.     define('AWS_ACCESS_KEY_ID', 'AMWSSIENUTNLKDJLKJDLKJLKJLKJ');
  10.     define('AWS_SECRET_ACCESS_KEY', '8LKJFOD8S77S99788D99A/;P98JDJAOKDHK');  
  11.  
  12.    /*********
  13.     * REQUIRED
  14.     *
  15.     * All MWS requests must contain a User-Agent header. The application
  16.     * name and version defined below are used in creating this value.
  17.     *********/
  18.     define('APPLICATION_NAME', 'DB Order Synchronization');
  19.     define('APPLICATION_VERSION', '0.1');
  20.  
  21.    /*********
  22.     * REQUIRED
  23.     *
  24.     * All MWS requests must contain the seller's merchant ID and
  25.     * marketplace ID.
  26.     *********/
  27.     define ('MERCHANT_ID', 'DJD799JD7S66W88DD9);
  28.    define ('MARKETPLACE_ID', 'LITNNDKUUSND88DH');
  29.  
  30.   /**********
  31.    * OPTIONAL ON SOME INSTALLATIONS
  32.    *
  33.    * Set include path to root of library, relative to Samples directory.
  34.    * Only needed when running library from local directory.
  35.    * If library is installed in PHP include path, this is not needed
  36.    *********/  
  37.    set_include_path(get_include_path() . PATH_SEPARATOR . '../../.');    
  38.  
  39.   /**********
  40.    * OPTIONAL ON SOME INSTALLATIONS  
  41.    *
  42.    * Autoload function is responsible for loading classes of the library on demand
  43.    *
  44.    * NOTE: Only one __autoload function is allowed by PHP per each PHP installation,
  45.    * and this function may need to be replaced with individual require_once statements
  46.    * in cases where other frameworks that define an __autoload already loaded.
  47.    *
  48.    * However, since this library follow common naming convention for PHP classes it
  49.    * may be possible to simply re-use an autoload mechanism defined by other frameworks
  50.    * (provided library is installed in the PHP include path), and so classes may just
  51.    * be loaded even when this function is removed
  52.    *********/  
  53.     function __autoload($className){
  54.        $filePath = str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
  55.        $includePaths = explode(PATH_SEPARATOR, get_include_path());
  56.        foreach($includePaths as $includePath){
  57.            if(file_exists($includePath . DIRECTORY_SEPARATOR . $filePath)){
  58.                require_once $filePath;
  59.                return;
  60.            }
  61.        }
  62.    }
<?php

   /********
    * REQUIRED
    * 
    * Access Key ID and Secret Acess Key ID, obtained from:
    * http://aws.amazon.com
    *********/
    define('AWS_ACCESS_KEY_ID', 'AMWSSIENUTNLKDJLKJDLKJLKJLKJ');
    define('AWS_SECRET_ACCESS_KEY', '8LKJFOD8S77S99788D99A/;P98JDJAOKDHK');  

   /*********
    * REQUIRED
    * 
    * All MWS requests must contain a User-Agent header. The application
    * name and version defined below are used in creating this value.
    *********/
    define('APPLICATION_NAME', 'DB Order Synchronization');
    define('APPLICATION_VERSION', '0.1');

   /*********
    * REQUIRED
    * 
    * All MWS requests must contain the seller's merchant ID and
    * marketplace ID.
    *********/
    define ('MERCHANT_ID', 'DJD799JD7S66W88DD9);
    define ('MARKETPLACE_ID', 'LITNNDKUUSND88DH');

   /********** 
    * OPTIONAL ON SOME INSTALLATIONS
    *
    * Set include path to root of library, relative to Samples directory.
    * Only needed when running library from local directory.
    * If library is installed in PHP include path, this is not needed
    *********/   
    set_include_path(get_include_path() . PATH_SEPARATOR . '../../.');    

   /**********
    * OPTIONAL ON SOME INSTALLATIONS  
    * 
    * Autoload function is responsible for loading classes of the library on demand
    * 
    * NOTE: Only one __autoload function is allowed by PHP per each PHP installation,
    * and this function may need to be replaced with individual require_once statements
    * in cases where other frameworks that define an __autoload already loaded.
    * 
    * However, since this library follow common naming convention for PHP classes it
    * may be possible to simply re-use an autoload mechanism defined by other frameworks
    * (provided library is installed in the PHP include path), and so classes may just 
    * be loaded even when this function is removed
    *********/   
     function __autoload($className){
        $filePath = str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
        $includePaths = explode(PATH_SEPARATOR, get_include_path());
        foreach($includePaths as $includePath){
            if(file_exists($includePath . DIRECTORY_SEPARATOR . $filePath)){
                require_once $filePath;
                return;
            }
        }
    }

This configuration file has two important tasks. It defines several constants related to developer and merchant keys and ids.

  1. define('AWS_ACCESS_KEY_ID', 'AMWSSIENUTNLKDJLKJDLKJLKJLKJ');
  2. define('AWS_SECRET_ACCESS_KEY', '8LKJFOD8S77S99788D99A/;P98JDJAOKDHK');
  3.  
  4. define ('MERCHANT_ID', 'DJD799JD7S66W88DD9);
  5. define ('MARKETPLACE_ID', 'LITNNDKUUSND88DH');
define('AWS_ACCESS_KEY_ID', 'AMWSSIENUTNLKDJLKJDLKJLKJLKJ');
define('AWS_SECRET_ACCESS_KEY', '8LKJFOD8S77S99788D99A/;P98JDJAOKDHK'); 

define ('MERCHANT_ID', 'DJD799JD7S66W88DD9);
define ('MARKETPLACE_ID', 'LITNNDKUUSND88DH');

The file also defines an autoloader, giving the developer access to any of the Orders API classes. Be sure to adjust the file path variable to match the actual server configuration.

  1.      function __autoload($className){
  2.         $filePath = str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
  3.         $includePaths = explode(PATH_SEPARATOR, get_include_path());
  4.         foreach($includePaths as $includePath){
  5.             if(file_exists($includePath . DIRECTORY_SEPARATOR . $filePath)){
  6.                 require_once $filePath;
  7.                 return;
  8.             }
  9.         }
  10.     }
     function __autoload($className){
        $filePath = str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
        $includePaths = explode(PATH_SEPARATOR, get_include_path());
        foreach($includePaths as $includePath){
            if(file_exists($includePath . DIRECTORY_SEPARATOR . $filePath)){
                require_once $filePath;
                return;
            }
        }
    }

This configuration is then included in the file that will be actually grabbing the order information from Amazon.

  1. include_once ('.config.inc.php');
include_once ('.config.inc.php');

Set Up Script Variables

Next, set up a few of the scripts variables, including establishing the proper URL for contacting the Amazon MWS.

  1. $serviceUrl = "https://mws.amazonservices.com/Orders/2011-01-01";
  2. $ordersArray = array();
$serviceUrl = "https://mws.amazonservices.com/Orders/2011-01-01";
$ordersArray = array();

Here the variable $serviceUrl points to the proper URL for U.S.-based merchants. The Orders API documentation lists all of the possible URLs.

The $ordersArray will be used to store order information in a form that should be relatively easy to add to nearly any ecommerce platform.

The variables $config and $service are assigned configuration values and create a new instance of the MarketplaceWebServiceOrders_Client.

  1.  $config = array (
  2.    'ServiceURL' => $serviceUrl,
  3.    'ProxyHost' => null,
  4.    'ProxyPort' => -1,
  5.    'MaxErrorRetry' => 3,
  6.  );
  7.  
  8.  $service = new MarketplaceWebServiceOrders_Client(
  9.         AWS_ACCESS_KEY_ID,
  10.         AWS_SECRET_ACCESS_KEY,
  11.         APPLICATION_NAME,
  12.         APPLICATION_VERSION,
  13.         $config
  14. );
 $config = array (
   'ServiceURL' => $serviceUrl,
   'ProxyHost' => null,
   'ProxyPort' => -1,
   'MaxErrorRetry' => 3,
 );

 $service = new MarketplaceWebServiceOrders_Client(
        AWS_ACCESS_KEY_ID,
        AWS_SECRET_ACCESS_KEY,
        APPLICATION_NAME,
        APPLICATION_VERSION,
        $config
);

Prepare the Order Data Request

Next the script should prepare the order data request, passing the merchant’s id and specifying a start date and time from which new orders should be retrieved.

  1. // Prepare to get Amazon Order Data
  2.  $request = new MarketplaceWebServiceOrders_Model_ListOrdersRequest();
  3.  $request->setSellerId(MERCHANT_ID);
  4.  $request->setCreatedAfter(new DateTime('2012-07-03 12:00:00', new DateTimeZone('UTC')));
// Prepare to get Amazon Order Data
 $request = new MarketplaceWebServiceOrders_Model_ListOrdersRequest();
 $request->setSellerId(MERCHANT_ID);
 $request->setCreatedAfter(new DateTime('2012-07-03 12:00:00', new DateTimeZone('UTC')));

In the example, a static date and time was used, but it may make since to set this to look 15 minutes into the past. This date and time should be coordinated with the cron job that will run the script. In this way, only new orders will be collected.

The request above will return a list of orders, but won’t give up individual order information, so a second order data request is also made ready.

  1. // Prepare to get a list of products for each Amazon order
  2.  $marketplaceIdList = new MarketplaceWebServiceOrders_Model_MarketplaceIdList();
  3.  $marketplaceIdList->setId(array(MARKETPLACE_ID));
  4.  $request->setMarketplaceId($marketplaceIdList);
// Prepare to get a list of products for each Amazon order
 $marketplaceIdList = new MarketplaceWebServiceOrders_Model_MarketplaceIdList();
 $marketplaceIdList->setId(array(MARKETPLACE_ID));
 $request->setMarketplaceId($marketplaceIdList);

Parse the Order Data

Next create a function to parse the order information once it is retrieved. Take a look at the entire function below. Some of its important features will get specific attention below.

  1. function get_amazon_orders(MarketplaceWebServiceOrders_Interface $service, $request, &$ordersArray){
  2.     try{
  3.         $response = $service->listOrders($request);
  4.         $listOrdersResult = $response->getListOrdersResult();
  5.         $orders = $listOrdersResult->getOrders();
  6.         $orderList = $orders->getOrder();
  7.  
  8.         foreach ($orderList as $order) {
  9.             $shippingAddress = $order->getShippingAddress();
  10.             $orderTotal = $order->getOrderTotal();
  11.  
  12.             $orderItems = new MarketplaceWebServiceOrders_Model_ListOrderItemsRequest();
  13.             $orderItems->setSellerId(MERCHANT_ID);
  14.             $orderItems->setAmazonOrderId($order->getAmazonOrderId());
  15.  
  16.             $order_items_array = array();
  17.  
  18.             try {
  19.                 $orderItemsResponse = $service->listOrderItems($orderItems);
  20.                 $listOrderItemsResult = $orderItemsResponse->getListOrderItemsResult();
  21.                 $orderItems = $listOrderItemsResult->getOrderItems();
  22.                 $orderItemList = $orderItems->getOrderItem();
  23.                 foreach ($orderItemList as $orderItem) {
  24.                     $itemPrice = $orderItem->getItemPrice();
  25.                     $shippingPrice = $orderItem->getShippingPrice();
  26.                     $order_items_specs = array(
  27.                         'name' => $orderItem->getTitle(),
  28.                         'qty' => $orderItem->getQuantityOrdered(),
  29.                         'price_each' => $itemPrice->getAmount(),
  30.                         'shipping_price' => $shippingPrice->getAmount()
  31.                     );
  32.                     $order_items_array[] = $order_items_specs;
  33.                 }  
  34.             }catch (MarketplaceWebServiceOrders_Exception $ex) {
  35.                     //TODO. I need to manage these exceptions.
  36.             }  
  37.  
  38.             $individual_order_array = array(
  39.                 'amazon_order_id' => $order->getAmazonOrderId(),
  40.                 'purchase_date' => $order->getPurchaseDate(),
  41.                 'amazon_order_status' => $order->getOrderStatus(),
  42.                 'shipping_level' => $order->getShipServiceLevel(),
  43.                 'ship_to_name' => $shippingAddress->getName(),
  44.                 'ship_to_addr_one' => $shippingAddress->getAddressLine1(),
  45.                 'ship_to_addr_two' => $shippingAddress->getAddressLine2(),
  46.                 'ship_to_addr_three' => $shippingAddress->getAddressLine3(),
  47.                 'city' => $shippingAddress->getCity(),
  48.                 'state' => $shippingAddress->getStateOrRegion(),
  49.                 'zip' => $shippingAddress->getPostalCode(),
  50.                 'country' => $shippingAddress->getCountryCode(),
  51.                 'phone' => $shippingAddress->getPhone(),
  52.                 'total' => $orderTotal->getAmount(),
  53.                 'payment_method' => $order->getPaymentMethod(),
  54.                 'amazon_marketplace_id' => $order->getMarketplaceId(),
  55.                 'buyer_email' => $order->getBuyerEmail(),
  56.                 'buyer_name' => $order->getBuyerName(),
  57.                 'item_array' => $order_items_array
  58.  
  59.             );
  60.  
  61.             //print_r($ordersArray);
  62.             $ordersArray[] = $individual_order_array;
  63.  
  64.         }
  65.  
  66.     } catch (MarketplaceWebServiceOrders_Exception $ex){
  67.         //TODO: I need to have this send me an email when there are errors.
  68.     }
  69.  
  70.  }
function get_amazon_orders(MarketplaceWebServiceOrders_Interface $service, $request, &$ordersArray){
    try{
        $response = $service->listOrders($request);
        $listOrdersResult = $response->getListOrdersResult();
        $orders = $listOrdersResult->getOrders();
        $orderList = $orders->getOrder();

        foreach ($orderList as $order) {
            $shippingAddress = $order->getShippingAddress();
            $orderTotal = $order->getOrderTotal();

            $orderItems = new MarketplaceWebServiceOrders_Model_ListOrderItemsRequest();
            $orderItems->setSellerId(MERCHANT_ID);
            $orderItems->setAmazonOrderId($order->getAmazonOrderId());

            $order_items_array = array();

            try {
                $orderItemsResponse = $service->listOrderItems($orderItems);
                $listOrderItemsResult = $orderItemsResponse->getListOrderItemsResult();
                $orderItems = $listOrderItemsResult->getOrderItems();
                $orderItemList = $orderItems->getOrderItem();
                foreach ($orderItemList as $orderItem) {
                    $itemPrice = $orderItem->getItemPrice();
                    $shippingPrice = $orderItem->getShippingPrice();
                    $order_items_specs = array(
                        'name' => $orderItem->getTitle(),
                        'qty' => $orderItem->getQuantityOrdered(),
                        'price_each' => $itemPrice->getAmount(),
                        'shipping_price' => $shippingPrice->getAmount()
                    );
                    $order_items_array[] = $order_items_specs;
                }   
            }catch (MarketplaceWebServiceOrders_Exception $ex) {
                    //TODO. I need to manage these exceptions.
            }   

            $individual_order_array = array(
                'amazon_order_id' => $order->getAmazonOrderId(),
                'purchase_date' => $order->getPurchaseDate(),
                'amazon_order_status' => $order->getOrderStatus(),
                'shipping_level' => $order->getShipServiceLevel(),
                'ship_to_name' => $shippingAddress->getName(),
                'ship_to_addr_one' => $shippingAddress->getAddressLine1(),
                'ship_to_addr_two' => $shippingAddress->getAddressLine2(),
                'ship_to_addr_three' => $shippingAddress->getAddressLine3(),
                'city' => $shippingAddress->getCity(),
                'state' => $shippingAddress->getStateOrRegion(),
                'zip' => $shippingAddress->getPostalCode(),
                'country' => $shippingAddress->getCountryCode(),
                'phone' => $shippingAddress->getPhone(),
                'total' => $orderTotal->getAmount(),
                'payment_method' => $order->getPaymentMethod(),
                'amazon_marketplace_id' => $order->getMarketplaceId(),
                'buyer_email' => $order->getBuyerEmail(),
                'buyer_name' => $order->getBuyerName(),
                'item_array' => $order_items_array

            );

            //print_r($ordersArray);
            $ordersArray[] = $individual_order_array;

        }

    } catch (MarketplaceWebServiceOrders_Exception $ex){
        //TODO: I need to have this send me an email when there are errors.
    }

 }

A series of statements stores the retrieved order data (without the individual item information) in $orderList.

  1. $response = $service->listOrders($request);
  2. $listOrdersResult = $response->getListOrdersResult();
  3. $orders = $listOrdersResult->getOrders();
  4. $orderList = $orders->getOrder();
$response = $service->listOrders($request);
$listOrdersResult = $response->getListOrdersResult();
$orders = $listOrdersResult->getOrders();
$orderList = $orders->getOrder();

A foreach statement accesses the ListOrderItemsRequest(), gathering the individual item information, which is stored in $orderItems.

  1. foreach ($orderList as $order) {
  2.     $shippingAddress = $order->getShippingAddress();
  3.     $orderTotal = $order->getOrderTotal();
  4.  
  5.     $orderItems = new MarketplaceWebServiceOrders_Model_ListOrderItemsRequest();
  6.     $orderItems->setSellerId(MERCHANT_ID);
  7.     $orderItems->setAmazonOrderId($order->getAmazonOrderId());
  8.  
  9.     …
  10.  
  11.     $orderItemsResponse = $service->listOrderItems($orderItems);
  12.     $listOrderItemsResult = $orderItemsResponse->getListOrderItemsResult();
  13.     $orderItems = $listOrderItemsResult->getOrderItems();
  14.     $orderItemList = $orderItems->getOrderItem();
foreach ($orderList as $order) {
    $shippingAddress = $order->getShippingAddress();
    $orderTotal = $order->getOrderTotal();

    $orderItems = new MarketplaceWebServiceOrders_Model_ListOrderItemsRequest();
    $orderItems->setSellerId(MERCHANT_ID);
    $orderItems->setAmazonOrderId($order->getAmazonOrderId());

    …

    $orderItemsResponse = $service->listOrderItems($orderItems);
    $listOrderItemsResult = $orderItemsResponse->getListOrderItemsResult();
    $orderItems = $listOrderItemsResult->getOrderItems();
    $orderItemList = $orderItems->getOrderItem();

Eventually, all of the individual order data is stored in an array.

  1. $order_items_specs = array(
  2.     'name' => $orderItem->getTitle(),
  3.     'qty' => $orderItem->getQuantityOrdered(),
  4.     'price_each' => $itemPrice->getAmount(),
  5.     'shipping_price' => $shippingPrice->getAmount()
  6.  
  7. ...
  8.  
  9. $individual_order_array = array(
  10.     'amazon_order_id' => $order->getAmazonOrderId(),
  11.     'purchase_date' => $order->getPurchaseDate(),
  12.     'amazon_order_status' => $order->getOrderStatus(),
  13.     'shipping_level' => $order->getShipServiceLevel(),
  14.     'ship_to_name' => $shippingAddress->getName(),
  15.     'ship_to_addr_one' => $shippingAddress->getAddressLine1(),
  16.     'ship_to_addr_two' => $shippingAddress->getAddressLine2(),
  17.     'ship_to_addr_three' => $shippingAddress->getAddressLine3(),
  18.     'city' => $shippingAddress->getCity(),
  19.     'state' => $shippingAddress->getStateOrRegion(),
  20.     'zip' => $shippingAddress->getPostalCode(),
  21.     'country' => $shippingAddress->getCountryCode(),
  22.     'phone' => $shippingAddress->getPhone(),
  23.     'total' => $orderTotal->getAmount(),
  24.     'payment_method' => $order->getPaymentMethod(),
  25.     'amazon_marketplace_id' => $order->getMarketplaceId(),
  26.     'buyer_email' => $order->getBuyerEmail(),
  27.     'buyer_name' => $order->getBuyerName(),
  28.     'item_array' => $order_items_array
  29.  
  30. );
$order_items_specs = array(
    'name' => $orderItem->getTitle(),
    'qty' => $orderItem->getQuantityOrdered(),
    'price_each' => $itemPrice->getAmount(),
    'shipping_price' => $shippingPrice->getAmount()

...

$individual_order_array = array(
    'amazon_order_id' => $order->getAmazonOrderId(),
    'purchase_date' => $order->getPurchaseDate(),
    'amazon_order_status' => $order->getOrderStatus(),
    'shipping_level' => $order->getShipServiceLevel(),
    'ship_to_name' => $shippingAddress->getName(),
    'ship_to_addr_one' => $shippingAddress->getAddressLine1(),
    'ship_to_addr_two' => $shippingAddress->getAddressLine2(),
    'ship_to_addr_three' => $shippingAddress->getAddressLine3(),
    'city' => $shippingAddress->getCity(),
    'state' => $shippingAddress->getStateOrRegion(),
    'zip' => $shippingAddress->getPostalCode(),
    'country' => $shippingAddress->getCountryCode(),
    'phone' => $shippingAddress->getPhone(),
    'total' => $orderTotal->getAmount(),
    'payment_method' => $order->getPaymentMethod(),
    'amazon_marketplace_id' => $order->getMarketplaceId(),
    'buyer_email' => $order->getBuyerEmail(),
    'buyer_name' => $order->getBuyerName(),
    'item_array' => $order_items_array

);

Printing out the array shows that the order information has been successfully captured.

  1.  print_r($ordersArray);
 print_r($ordersArray);
  1. Array
  2. (
  3.     [0] => Array
  4.         (
  5.             [amazon_order_id] => 607-8495057-0957213
  6.             [purchase_date] => 2011-11-09T21:10:28.000Z
  7.             [amazon_order_status] => Shipped
  8.             [shipping_level] => Std Cont US Street Addr
  9.             [ship_to_name] => John Doe
  10.             [ship_to_addr_one] => 1521 NE 12TH ST
  11.             [ship_to_addr_two] =>
  12.             [ship_to_addr_three] =>
  13.             [city] => SEATTLE
  14.             [state] => WA
  15.             [zip] => 33426
  16.             [country] => US
  17.             [phone] => 203-123-7620
  18.             [total] => 13.78
  19.             [payment_method] => Other
  20.             [amazon_marketplace_id] => DLKSJIDLKJGOIDHNE8
  21.             [buyer_email] => sjdlkd889djj7d8fau9s98dhhdweege@marketplace.amazon.com
  22.             [buyer_name] => John Doe
  23.             [item_array] => Array
  24.                 (
  25.                     [0] => Array
  26.                         (
  27.                             [seller_sku] => 954228
  28.                             [name] => Cowboy Magic Detangler 4oz
  29.                             [qty] => 1
  30.                             [price_each] => 19.29
  31.                             [shipping_price] => 4.49
  32.                         )
  33.  
  34.                 )
  35.  
  36.         )
Array
(
    [0] => Array
        (
            [amazon_order_id] => 607-8495057-0957213
            [purchase_date] => 2011-11-09T21:10:28.000Z
            [amazon_order_status] => Shipped
            [shipping_level] => Std Cont US Street Addr
            [ship_to_name] => John Doe
            [ship_to_addr_one] => 1521 NE 12TH ST
            [ship_to_addr_two] => 
            [ship_to_addr_three] => 
            [city] => SEATTLE
            [state] => WA
            [zip] => 33426
            [country] => US
            [phone] => 203-123-7620
            [total] => 13.78
            [payment_method] => Other
            [amazon_marketplace_id] => DLKSJIDLKJGOIDHNE8
            [buyer_email] => sjdlkd889djj7d8fau9s98dhhdweege@marketplace.amazon.com
            [buyer_name] => John Doe
            [item_array] => Array
                (
                    [0] => Array
                        (
                            [seller_sku] => 954228
                            [name] => Cowboy Magic Detangler 4oz
                            [qty] => 1
                            [price_each] => 19.29
                            [shipping_price] => 4.49
                        )

                )

        )

Summing Up

In just a few steps, an order was retrieved form the Amazon MWS. The resulting array could be added to nearly any good ecommerce platform, effectively adding orders placed on Amazon to a merchant’s customary order processing workflow.

Related Articles


Comment ( 1 )

Have Something To Say ?

  1. Gary January 9, 2013

    Thank you for your article which looks great!
    Can I just ask a simple question please, is it possible to retrieve the standard ‘packing slip’ invoice with MWS, or would you have to try and reproduce this yourself?
    Many thanks
    Gary