我正在尝试使用PHP中的MWS API将多个跟踪号上传到Amazon订单,但不知道对此的XML请求是什么。这是我正在使用的XML,最终会上传最后一个跟踪号。
$feed = <<<EOD
<?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>XXX</MerchantIdentifier>
</Header>
<MessageType>OrderFulfillment</MessageType>
<Message>
<MessageID>1</MessageID>
<OrderFulfillment>
<AmazonOrderID>$orderId</AmazonOrderID>
<FulfillmentDate>$FulfillmentDate</FulfillmentDate>
<FulfillmentData>
<CarrierCode>$carrierCode</CarrierCode>
<ShipperTrackingNumber>'1Z7X887R0370783509'</ShipperTrackingNumber>
</FulfillmentData>
<Item>
<Quantity>1</Quantity>
</Item>
</OrderFulfillment>
</Message>
<MessageID>2</MessageID>
<OrderFulfillment>
<AmazonOrderID>$orderId</AmazonOrderID>
<FulfillmentDate>$FulfillmentDate</FulfillmentDate>
<FulfillmentData>
<CarrierCode>$carrierCode</CarrierCode>
<ShipperTrackingNumber>'1Z7X887R0075127492'</ShipperTrackingNumber>
</FulfillmentData>
<Item>
<Quantity>1</Quantity>
</Item>
</OrderFulfillment>
</Message>
<MessageID>3</MessageID>
<OrderFulfillment>
<AmazonOrderID>$orderId</AmazonOrderID>
<FulfillmentDate>$FulfillmentDate</FulfillmentDate>
<FulfillmentData>
<CarrierCode>$carrierCode</CarrierCode>
<ShipperTrackingNumber>'1Z7X887R0375972085'</ShipperTrackingNumber>
</FulfillmentData>
<Item>
<Quantity>1</Quantity>
</Item>
</OrderFulfillment>
</Message>
</AmazonEnvelope>
EOD;
感谢您的帮助!
答案 0 :(得分:0)
尝试以下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>My Store</MerchantIdentifier>
</Header>
<MessageType>OrderFulfillment</MessageType>
<Message>
<MessageID>1</MessageID>
<OrderFulfillment>
<MerchantOrderID>1234567</MerchantOrderID>
<MerchantFulfillmentID>1234567</MerchantFulfillmentID>
<FulfillmentDate>2002-05-01T15:36:33-08:00</FulfillmentDate>
<FulfillmentData>
<CarrierCode>UPS</CarrierCode>
<ShippingMethod>Second Day</ShippingMethod>
<ShipperTrackingNumber>1Z7X887R0075127492</ShipperTrackingNumber>
</FulfillmentData>
<Item>
<MerchantOrderItemID>11</MerchantOrderItemID>
<MerchantFulfillmentItemID>11</MerchantFulfillmentItemID>
<Quantity>2</Quantity>
</Item>
</OrderFulfillment>
</Message>
<Message>
<MessageID>2</MessageID>
<OrderFulfillment>
<MerchantOrderID>1234567</MerchantOrderID>
<MerchantFulfillmentID>1234567</MerchantFulfillmentID>
<FulfillmentDate>2002-05-01T15:36:33-08:00</FulfillmentDate>
<FulfillmentData>
<CarrierCode>UPS</CarrierCode>
<ShippingMethod>Second Day</ShippingMethod>
<ShipperTrackingNumber>1Z7X887R0075127492</ShipperTrackingNumber>
</FulfillmentData>
<Item>
<MerchantOrderItemID>22</MerchantOrderItemID>
<MerchantFulfillmentItemID>22</MerchantFulfillmentItemID>
<Quantity>2</Quantity>
</Item>
</OrderFulfillment>
</Message>
</AmazonEnvelope>
有关XSD的更多信息,您可以参考Amazon order Fulfilment XSD
答案 1 :(得分:0)
好像您没有正确打开邮件。
尝试一下:
</Message>
Add this --> <Message>
<MessageID>2</MessageID>
</Message>
Add this --> <Message>
<MessageID>3</MessageID>