How to update prices of products with Amazon Marketplace Web Service (Amazon MWS) API

amazon-mws

Just tried to find out, how easy (or maybe difficult) it is to update prices of products of a amazon marketplace shop.

After some search I found docs about "Amazon Marketplace Web Service (Amazon MWS)". I have also checked the API docs and one of the client implementation, but I am not able (or blind, stupid, whatever) to find any docs about setting a price for a specific product.

Or do I need another API?

EDIT: Thanks to @ScottG and @Keyur I found the 'missing link' Feeds. http://docs.developer.amazonservices.com/en_US/feeds/Feeds_SubmitFeed.html#
For PHP there is a nice example in the PHP-Client library under src\MarketplaceWebService\Samples\SubmitFeedSample.php.
See @Keyur's answer for the _POST_PRODUCT_PRICING_DATA_ FeedType example.

Best Answer

You need to send following Feed to amazon mws feed api, you send price feed of 15 different SKU in one request by looping through element for each SKU

$feed = <<< EOD
<?xml version="1.0" encoding="utf-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>$merchant_token</MerchantIdentifier>
</Header>
<MessageType>Price</MessageType>
<Message>
  <MessageID>$i</MessageID>
  <Price>
    <SKU>$sku</SKU>
    <StandardPrice currency="$currency">$new_price</StandardPrice>
  </Price>
</Message>
</AmazonEnvelope>
EOD;

$feedHandle = @fopen('php://temp', 'rw+');
fwrite($feedHandle, $feed);
rewind($feedHandle);

$parameters = array(
    'Merchant' => $MERCHANT_ID,
    'MarketplaceIdList' => $marketplaceIdArray,
    'FeedType' => '_POST_PRODUCT_PRICING_DATA_',
    'FeedContent' => $feedHandle,
    'PurgeAndReplace' => false, //Leave this PurgeAndReplace to false so that it want replace whole product in amazon inventory
    'ContentMd5' => base64_encode(md5(stream_get_contents($feedHandle), true))
);

$request = new MarketplaceWebService_Model_SubmitFeedRequest($parameters);
$return_feed = invokeSubmitFeed($service, $request);
fclose($feedHandle);
Related Topic