How to cancel ONE item using amazon mws order adjustment feed? - amazon-mws

I've been trying to cancel single item from an amazon order using their order adjustment feed, but every time I submit request I get:
ERROR 18028: The data you submitted with this item is incomplete or invalid. Please resubmit the item with all required fields completed with valid data.
I've used this xml in my requests:
<?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>XXXXXXXXX</MerchantIdentifier>
</Header>
<MessageType>OrderAdjustment</MessageType>
<Message>
<MessageID>1</MessageID>
<OperationType>Update</OperationType>
<OrderAdjustment>
<AmazonOrderID>305-XXXXXXX-XXXXXXX</AmazonOrderID>
<ActionType>Cancel</ActionType>
<AdjustedItem>
<AmazonOrderItemCode>209XXXXXXXXXXX</AmazonOrderItemCode>
<AdjustmentReason>NoInventory</AdjustmentReason>
<QuantityCancelled>1</QuantityCancelled>
</AdjustedItem>
</OrderAdjustment>
</Message>
</AmazonEnvelope>
I have double checked my xml and it seems to be valid according to amazon's xsd schema.
I would appreciate if someone with similar problem could share their experience.

TLDR: Try setting the ActionType to Refund instead of Cancel.
This concerns merchant that do their own fulfillment.
Two scenarios come to mind, an order with:
two items, each with quantity 1
one item with quantity 2
Logically, a partial cancel involves fulfilling one item and canceling the second.
Since the MWS API does not have a single operation for a partial cancel, the application has to first fulfill the second item and then refund it.
That means first sending an OrderFulfillment message for the second item and then sending an OrderAdjustment for it.
I've found that the ActionType of Cancel gives the same error message as seen in the original post while a value of Refund is successfully processed.

Related

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

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.
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);
Products are sent to Amazon using Feeds. We use a third party to handle ours for us, but you can do so yourself using the Feeds API and the pricing FeedType. There are templates you can download to help you out. You can then use one of the client libraries to send this feed to Amazon.

Posting hazardous materials information to Amazon MWS

We are using MWS service to create/update items on Amazon marketplace. Everything is working fine except we are not able to send hazardous item info for an item through XML.
Which XML fields should we use for hazardous materials information?
Example Feed:
<?xml version="1.0" ?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema
-
instance" xsi:noNamespaceSchemaLocation="amzn
-
envelop
e.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>M_SELLER_354577</MerchantIdentifier>
</Header>
<MessageType>Product</MessageType>
<PurgeAndReplace>true</PurgeAndReplace>
<Message>
<MessageID>1</MessageID>
<Op
erationType>Update</OperationType>
<Product>
<SKU>1Z
-
500ABR
-
FLAT</SKU>
<ProductTaxCode>A_GEN_TAX</ProductTaxCode>
<LaunchDate>2005
-
07
-
26T00:00:01</LaunchDate>
<DescriptionData>
<Title>Lyric 500 tc Queen Flat Sheet, Ivory</Title>
<Brand>Peaco
ck Alley</Brand>
<Description>Lyric sheeting by Peacock Alley is the epitome of simple and classic</Description>
<BulletPoint>made in Italy</BulletPoint>
<BulletPoint>500 thr
ead count</BulletPoint>
<BulletPoint>plain weave (percale)</BulletPoint>
<BulletPoint>100% Egyptian cotton</BulletPoint>
<Manufacturer>Peacock Alley</Manufacturer>
<SearchTerms>bedding</SearchTerms>
<SearchTerms>Sheets</SearchTerms>
<Item
Type>flat
-
sheets</ItemType>
<IsGiftWrapAvailable>false</IsGiftWrapAvailable>
<IsGiftMessageAvailable>false</IsGiftMessageAvailable>
<RecommendedBrowseNode>60583031</RecommendedBrowseNode>
<RecommendedBrowseNode>60576021<
/RecommendedBrowseNode>
</DescriptionData>
<ProductData>
<Home>
<Parentage>variation
-
parent</Parentage>
<VariationData>
<VariationTheme>Size
-
Color</VariationTheme>
</VariationData>
<Material>cotton</Material>
<
ThreadCount>500</ThreadCount>
</Home>
</ProductData>
</Product>
</Message>
<Message>
</AmazonEnvelope>
There are a few fields in the XSD that deal with hazardous materials
There is the <EUcompliance> tag, but according to the XSD, that could only be used instead of <Home> which does not make any sense to me. For details look at Products.xsd and EUcompliance.xsd
There are <HazmatItem>s in <FBA> and <ToysBaby> but they share the same fate as the above. For details look at amzn-base.xsd for its definition and FBA.xsd and ToysBaby for its use.
I have no clue why neither is valid alongside other product types, but hey, that's what their XSDs say, and it's not the first time I'm puzzled what the schema designers at Amazon were thinking... so you're left with
Put it in <OtherItemAttributes> which is valid for all product types. It would go between </ItemType> and <IsGiftWrapAvailable>. For details look at products.xsd
I don't know why you'd want to include hazmat information in the feed, but that's where I'd put it.
(BTW, you have an extra tag at the end which shouldn't be there)

Issue with stock update on amazon with mws

We are using the following details for updating the quantity of a product in amazon. Wile using scratch pad, option Feeds->SubmitFeed
Set the required parameters and pass the following XML
<?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>$merchantID</MerchantIdentifier>
</Header>
<MessageType>Inventory</MessageType>
<Message>
<MessageID>1</MessageID>
<OperationType>Update</OperationType>
<Inventory>
<SKU>$SKU</SKU>
<Quantity>8</Quantity>
</Inventory>
</Message>
</AmazonEnvelope>
feed type : _POST_INVENTORY_AVAILABILITY_DATA_
we are getting in response for the same - submissionid. I know it takes sometime to update. But i waited and waited .. 4 atleast 15 hrs (not minutes) but it still was in process and the quantity was never updated.
Am getting in the following response
<?xml version="1.0"?>
<SubmitFeedResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<SubmitFeedResult>
<FeedSubmissionInfo>
<FeedSubmissionId>6791310806</FeedSubmissionId>
<FeedType>_POST_INVENTORY_AVAILABILITY_DATA_</FeedType>
<SubmittedDate>2013-03-21T19:48:37+00:00</SubmittedDate>
<FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus>
</FeedSubmissionInfo>
</SubmitFeedResult>
<ResponseMetadata>
<RequestId>fd07bf18-4f6a-4786-bdf9-9d4db50956d0</RequestId>
</ResponseMetadata>
</SubmitFeedResponse>
and getting in following response on checking the status of the feed
<?xml version="1.0"?>
<ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<Error>
<Type>Sender</Type>
<Code>FeedProcessingResultNotReady</Code>
<Message>Feed Submission Result is not ready for Feed Submission Id: 6791310806</Message>
<Detail/>
</Error>
<RequestID>2c86128d-b53a-4fc3-80d1-6b41b53a8977</RequestID>
</ErrorResponse>
Can any1 guide me.. where did i go wrong .. in here? or if there is any better way to look on for the same.
The time it seems to be taking isn't normal. Submitted feeds usually switch to _IN_PROGRESS_ within a few minutes and then take another few minutes to complete, when the status switches to _DONE_. Short feeds like your example feed should take less than a minute to process.
In the past, I've seen one feed upload blocking another though. It seems that sometimes the MWS won't start processing one feed until a previous feed of the same user has gone trough (or for that matter: failed). Please check if you have other request that might block yours (GetFeedSubmissionList)
Apart from this, the answers you are getting from Amazon MWS are perfectly normal. Your feed was accepted and put into the processing queue. The queue status was set to _SUBMITTED_, and as long as it hasn't switched to DONE, you will get the FeedProcessingResultNotReady answer you were seeing.

What causes the InvalidEntity exception in the SFDC bulk api?

When creating a new bulk job through the API, I am getting an InvalidEntity as an exception code which isn't in SFDC's docs (pdf)
I'm making the following request
https://na13-api.salesforce.com/services/async/24.0/job
<?xml version="1.0" encoding="UTF-8"?>
<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<operation>query</operation>
<object>Campaign</object>
<concurrencyMode>Parallel</concurrencyMode>
<contentType>CSV</contentType>
</jobInfo>
And I get this response:
<?xml version="1.0" encoding="UTF-8"?><error
xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<exceptionCode>InvalidEntity</exceptionCode>
<exceptionMessage>Entity 'Campaign' is not supported by the Bulk API.</exceptionMessage>
</error>
I've excluded the headers but I do have accept & content encoding specified as gzip and the content is gzipped when it is sent and received.
The requests work correctly for
Lead
Contact
Opportunity
Task
Event
OpportunityContactRole
Account
CampaignMember
Note
Profile
RecordType
User
I only get the exception shown above for:
Campaign
UserLicense
OpportunityStage
OpportunityHistory
LeadHistory
I'm only using the bulk api to download csv's out of salesforce and I've only tried the above entities because I don't need any others.
It has been a very long time, but I think you can get this exception if one of your foreign key relationships is incorrect.

RequestThrottling issue in Amazon MWS API

I am testing API Sample of Amazon MWS API in C# for submit feeds however after setting AWS Secret key , access key etc. in code i am getting error of RequestThrottled , so there is details what is that but could not find any code sample how to resolved that.
I would like to upload feed.xml to amazon seller account
<?xml version="1.0" encoding="iso-8859-1"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>M_EXAMPLE_123456</MerchantIdentifier>
</Header>
<MessageType>Product</MessageType>
<PurgeAndReplace>true</PurgeAndReplace>
<Message>
<MessageID>1</MessageID>
<OperationType>Insert</OperationType>
<Product>
<SKU>56789</SKU>
<StandardProductID>
<Type>ASIN</Type>
<Value>B0EXAMPLEG</Value>
</StandardProductID>
<ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>
<DescriptionData>
<Title>Example Product Title</Title>
<Brand>Example Product Brand</Brand>
<Description>This is an example product description.</Description>
<BulletPoint>Example Bullet Point 1</BulletPoint>
<BulletPoint>Example Bullet Point 2</BulletPoint>
<MSRP currency="USD">25.19</MSRP>
<Manufacturer>Example Product Manufacturer</Manufacturer>
<ItemType>example-item-type</ItemType>
</DescriptionData>
<ProductData>
<Health>
<ProductType>
<HealthMisc>
<Ingredients>Example Ingredients</Ingredients>
<Directions>Example Directions</Directions>
</HealthMisc>
</ProductType>
</Health>
</ProductData>
</Product>
</Message>
</AmazonEnvelope>
Error getting as per below
Caught Exception: Request from SubmitFeed:AKIAJI4PSK4HXY6UCNMA;A2DNAGZJ1EWQLW is
throttled.
Response Status Code: ServiceUnavailable
Error Code: RequestThrottled
Error Type: Sender
Request ID: fc59c802-04da-4dd3-89a8-db5f525cac39
XML: <ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/"><Error><Typ
e>Sender</Type><Code>RequestThrottled</Code><Message>Request from SubmitFeed:AKI
AJI4PSK4HXY6UCNMA;A2DNAGZJ1EWQLW is throttled.</Message><Detail>System.Object</D
etail></Error><RequestId>fc59c802-04da-4dd3-89a8-db5f525cac39</RequestId></Error
Response>
How can this be resolved?
As per Amazon's API reference the SubmitFeed operation has a maximum request quota of 15 and a restore rate of a request every 2 minutes. This means that you're allowed to make calls to this operation in burst of 15, but after this you're throttled for 2 minutes, until Amazon allows you to make another request.
You can find this better explained in their developer guide where they describe better how they make use of the leaky bucket algorithm.
Probably there isn't anything wrong with your feed, but because you made too many requests (probably more than 15) you got throttled. My advice is to build your code in such a way that you take into consideration Amazon throttlening and have a back-off algorithm when you're being throttled (like come back after a "restore rate" period, specific to the type of call you're doing). Also, keep in mind that another limitation MWS has is of 10000 requests per hour across all type of calls.

Resources