Omer Anees
Omer Anees

Reputation: 133

Cancel order on Amazon by using Amazon Marketplace Web Service

I am using this code to ship my order on Amazon. This xml request is sent to the Amazon Marketplace Web Service, and my order gets shipped. Now I want to cancel the order using the same Web Service. But I am not sure what changes I have to make to the xml to perform the order cancel process. Can anyone help?

<cfsavecontent variable="Final_FulFillMent_XML">
    <?xml version="1.0" encoding="UTF-8"?>
    <AmazonEnvelope xsi:noNamespaceSchemaLocation="amzn-envelope.xsd" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <Header>
        <DocumentVersion>1.01</DocumentVersion>
        <MerchantIdentifier>xxxxxxxxxxxx</MerchantIdentifier>
    </Header>

    <MessageType>OrderFulfillment</MessageType>
    <Message>
        <MessageID>1</MessageID>
        <OrderFulfillment>
        <AmazonOrderID>#AmazonOrderID#</AmazonOrderID>
        <MerchantFulfillmentID>#MerchantFulfillmentID#</MerchantFulfillmentID>
        <FulfillmentDate>#FulfillmentDate#</FulfillmentDate>
        <FulfillmentData><CarrierCode>#CarrierCode#</CarrierCode>
        <ShippingMethod>#ShippingMethod#</ShippingMethod>
        <ShipperTrackingNumber>#ShippingTrackingNumber#</ShipperTrackingNumber>
        </FulfillmentData></OrderFulfillment>
    </Message>
</AmazonEnvelope>
</cfsavecontent>

<cfhttp method="post" url="#FinalQueryString#">
    <cfhttpparam name="Content-Type" type="header" value="text/xml; charset=iso-8859-1">
   <cfhttpparam name="FeedContent" type="body" value="#Final_FulFillMent_XML#">
   <cfhttpparam type="header" name="Content-MD5" value="#ToBase64(BinaryDecode(Hash(Final_FulFillMent_XML), 'hex'))#">       
</cfhttp>

Upvotes: 1

Views: 1312

Answers (1)

Hazzit
Hazzit

Reputation: 6882

To cancel entire orders, you need to modify the an "Order Acknowledge Feed" that you're probably sending already and specify a StatusCode of Failure and a CancelReason, e.g. BuyerCanceled.

To cancel partial orders, you need to send an "Order Adjustment Feed" which lets you specify how many items you were unable to ship and why.

Both XML feeds are described in Selling on Amazon: Guide to XML

Upvotes: 1

Related Questions