Closed marcelvossmint closed 2 years ago
@marcelvossmint You have to use the Feeds API to send an OrderConfirmation feed. See the not-so-helpful documentation available here: https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/use-case-guides/feeds-api-use-case-guide/feeds-api-use-case-guide_2021-06-30.md
You'll want to use the 2021-06-30 version, the 2020 version had requirements for encrypting the payload that made it difficult to implement, which were removed in the more recent version.
Eric
You don't have to understand what amazon was thinking with this api design...
But here we go.
I hope you never need to send a case asking for help. They pay an intern to send the exact same response to every case. There are forums somewhere which are ever so slightly more helpful. I've implemented what you are trying to do in Java. I'll try to help if I can.
I am using this library and there seems to be a wrapper around the feeds-api, so i hope it will be not too hard: https://github.com/amz-tools/amazon-sp-api#encrypt-and-upload-feeds
@marcelvossmint Were you able to get it working? The documentation looks very confusing, I am using NodeJS.
Yes, I got it working, want me to share some code?
Yes please if possible, will help me and others looking for this solution. @marcelvossmint
Basically, this is what I am doing:
async createShipment(orderId, trackingNbr, items) {
const feed = {
content: `<?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.02</DocumentVersion>
<MerchantIdentifier>${process.env.AWS_MERCHANT_ID}</MerchantIdentifier>
</Header>
<MessageType>OrderFulfillment</MessageType>
<Message>
<MessageID>1</MessageID>
<OrderFulfillment>
<AmazonOrderID>${orderId}</AmazonOrderID>
<FulfillmentDate>${new Date().toISOString()}</FulfillmentDate>
<FulfillmentData>
<CarrierName>DHL</CarrierName>
<ShippingMethod>Paket</ShippingMethod>
<ShipperTrackingNumber>${trackingNbr}</ShipperTrackingNumber>
</FulfillmentData>
${items.map(item => {
return `<Item>
<AmazonOrderItemCode>${item.OrderItemId}</AmazonOrderItemCode>
<Quantity>${item.QuantityOrdered}</Quantity>
</Item>`;
})}
</OrderFulfillment>
</Message>
</AmazonEnvelope>`,
contentType: 'text/xml; charset=utf-8'
};
const feed_upload_details = await this._api.callAPI({
operation: 'createFeedDocument',
endpoint: 'feeds',
body: {
contentType: feed.contentType
}
});
await this._api.upload(feed_upload_details, feed);
await this._api.callAPI({
operation: 'createFeed',
endpoint: 'feeds',
body: {
marketplaceIds: [process.env.AWS_MP_IDS],
feedType: 'POST_ORDER_FULFILLMENT_DATA',
inputFeedDocumentId: feed_upload_details.feedDocumentId
}
});
}
@marcelvossmint thank you for this example. I just spent the last two days trying to get help from Amazon Support with no luck. 5 support phone calls that were dropped and cookie cutter responses to the open cases. I am also using amazon-sp-api for getOrders and will try to follow your example here for the POST_ORDER_FULFILLMENT_DATA.
Have you had any luck with updating inventory using the the feed: POST_INVENTORY_AVAILABILITY_DATA or POST_FLAT_FILE_FULFILLMENT_DATA?
If so please include an example here! 🙏
This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.
closed for inactivity
I buy shipment labels and ship packages myself - without any fullfilment by amazon.
How do I mark orders as shipped via sp-api?
I guess this should be merchantFulfillment-createShipment call.
But this method is missing a parameter to set the trackingId.
What am I missing here?