UpdateOrdersResponse setImportedOrders(
CPAuth auth,
CPOrder[] importedOrders,
boolean mapOrderItemIds
);
PHP-Codesnippets and samples for this function can be found here.
Input
Parameter | Type | Optional | Comment |
auth | CPAuth | no | Authentication data |
importedOrders | CPOrder[] | no | A list of orders. Maximum of 100 per request! |
mapOrderItemIds | boolean | no | Set to true if you will send importedOrders[i].itemsOrders[y].id |
Output
Method returns an UpdateOrdersResponse
Description
Marks orders as imported so that the order will not be returned by getNewMarketplaceOrders anymore. Set your orderId (generated by Shop- or ERP-system) to be forwarded to the marketplace, if possible. After this call the order is identifiable also by your orderId for a specific shopToken in the entire System.
Fields
CPOrder.orderHeader.status.hasError is required and has to be set to true if an error occurred during import of the order (the order can be reviewed and changed in Channel Pilot later; error can be reset and the order can be retrieved by getNewMarketplaceOrders again. Set errorMessage and errorCode (your code) if necessary.
The order is identified by CPOrder.orderHeader.orderIdExternal and
CPOrder.orderHeader.source, so both fields are required. CPOrder.orderHeader.orderId is your orderId and required. There is no need send the orderIdExternal and source anymore in a future call, because the order is identifiable by your orderId.
You can optionally set unique orderItemIds. If you want to do so, set mapOrderItemIds to true and provide CPOrder.itemsOrdered[x].id in your call.
Use cases
You should perform a setImportedOrders immediately after processing the response of getNewMarketplaceOrders. Just retrieve the order(s), enrich the necessary data (status error occurs, orderId, orderItemId) and send the same object back to setImportedOrders.
Examples (SOAP-UI)
Successful imported order
Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v4="http://v4_2.seller.api.channelpilot.com/">
<soapenv:Header/>
<soapenv:Body>
<v4:setImportedOrders>
<auth>
<merchantId>xxxxxxxxxxx</merchantId>
<shopToken>xxxxxxxxxxx</shopToken>
</auth>
<importedOrders>
<!--Zero or more repetitions:-->
<item>
<orderHeader>
<orderId>123456</orderId>
<orderIdExternal>TEST_ORDER_531_1</orderIdExternal>
<source>ebay.de</source>
<status>
<identifier>20</identifier>
</status>
</orderHeader>
</item>
</importedOrders>
<mapOrderItemIds>0</mapOrderItemIds>
</v4:setImportedOrders>
</soapenv:Body>
</soapenv:Envelope>
Response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:setImportedOrdersResponse xmlns:ns1="http://v4_2.seller.api.channelpilot.com/">
<return>
<header>
<resultCode>200</resultCode>
<resultMessage/>
</header>
<updateResults>
<header>
<resultCode>200</resultCode>
<resultMessage/>
</header>
<orderHeader>
<orderId>123456</orderId>
<orderIdExternal>TEST_ORDER_531_1</orderIdExternal>
<orderIdExternalTransactionId/>
<source>ebay.de</source>
<status>
<identifier>20</identifier>
<publicTitle>Importiert</publicTitle>
<publicDescription>Bestellung wurde in den Shop importiert</publicDescription>
<hasError>false</hasError>
</status>
<orderTime/>
<purchaseOrderNumber/>
<isBusinessOrder>false</isBusinessOrder>
<marketPlaceSpecificData/>
</orderHeader>
</updateResults>
</return>
</ns1:setImportedOrdersResponse>
</soap:Body>
</soap:Envelope>
Successful imported order (with mapped order item ids)
Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v4="http://v4_2.seller.api.channelpilot.com/">
<soapenv:Header/>
<soapenv:Body>
<v4:setImportedOrders>
<auth>
<merchantId>xxxxxxxxxxx</merchantId>
<shopToken>xxxxxxxxxxx</shopToken>
</auth>
<importedOrders>
<item>
<orderHeader>
<orderId>123456</orderId>
<orderIdExternal>TEST_ORDER_533_294</orderIdExternal>
<source>amazon.de</source>
<status>
<identifier>20</identifier>
</status>
</orderHeader>
<itemsOrdered>
<id>item_1</id>
<idExternal>TEST_ORDER_533_294_ITEM_1</idExternal>
</itemsOrdered>
<itemsOrdered>
<id>item_2</id>
<idExternal>TEST_ORDER_533_294_ITEM_2</idExternal>
</itemsOrdered>
</item>
</importedOrders>
<mapOrderItemIds>true</mapOrderItemIds>
</v4:setImportedOrders>
</soapenv:Body>
</soapenv:Envelope>
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/>
<soap:Body>
<ns1:setImportedOrdersResponse xmlns:ns1="http://v4_2.seller.api.channelpilot.com/">
<return>
<header>
<resultCode>200</resultCode>
<resultMessage/>
</header>
<updateResults>
<header>
<resultCode>200</resultCode>
<resultMessage/>
</header>
<orderHeader>
<orderId>123456</orderId>
<orderIdExternal>TEST_ORDER_533_294</orderIdExternal>
<source>amazon.de</source>
<status>
<identifier>20</identifier>
<publicTitle>Importiert</publicTitle>
<publicDescription>Bestellung wurde in den Shop importiert</publicDescription>
<hasError>false</hasError>
</status>
<isBusinessOrder>false</isBusinessOrder>
</orderHeader>
</updateResults>
</return>
</ns1:setImportedOrdersResponse>
</soap:Body>
</soap:Envelope>
Failed imported order
Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v4="http://v4_2.seller.api.channelpilot.com/">
<soapenv:Header/>
<soapenv:Body>
<v4:setImportedOrders>
<auth>
<merchantId>xxxxxxxxxxx</merchantId>
<shopToken>xxxxxxxxxxx</shopToken>
</auth>
<importedOrders>
<!--Zero or more repetitions:-->
<item>
<orderHeader>
<orderIdExternal>TEST_ORDER_531_1</orderIdExternal>
<source>ebay.de</source>
<status>
<hasError>true</hasError>
<errorCode>YOUR_DEFINED_ERROR_CODE</errorCode>
<errorMessage>YOUR_DEFINED_ERROR_MESSAGE</errorMessage>
</status>
</orderHeader>
</item>
</importedOrders>
<mapOrderItemIds>0</mapOrderItemIds>
</v4:setImportedOrders>
</soapenv:Body>
</soapenv:Envelope>
Response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:setImportedOrdersResponse xmlns:ns1="http://v4_2.seller.api.channelpilot.com/">
<return>
<header>
<resultCode>200</resultCode>
<resultMessage/>
</header>
<updateResults>
<header>
<resultCode>200</resultCode>
<resultMessage/>
</header>
<orderHeader>
<orderIdExternal>TEST_ORDER_531_1</orderIdExternal>
<orderIdExternalTransactionId/>
<source>ebay.de</source>
<status>
<errorCode>YOUR_DEFINED_ERROR_CODE</errorCode>
<errorMessage>YOUR_DEFINED_ERROR_MESSAGE</errorMessage>
<hasError>true</hasError>
</status>
<orderTime/>
<purchaseOrderNumber/>
<isBusinessOrder>false</isBusinessOrder>
<marketPlaceSpecificData/>
</orderHeader>
</updateResults>
</return>
</ns1:setImportedOrdersResponse>
</soap:Body>
</soap:Envelope>
