Skip to main content

Orders via Seller-API

Import orders

During this process, orders are retrieved for the store and successful order import is reported to Channel Pilot Pro. In the process, order number and order item numbers are transferred to Channel Pilot Pro.

Sample implementation of the order import:

// Initialize ChannelPilotSellerApi
$api = new ChannelPilotSellerAPI_v1_0("cpMerchantId", "cpApiToken");

$run = true;
while($run){
// Request new marketplace orders from ChannelPilot
$response = $api->getNewMarketplaceOrders();

// Check if request was successful
if ($response->header->resultCode == CPResultCodes::SUCCESS) {
if (sizeof($response->orders) == 0) {
// No orders to import. Do nothing!
} else {

$run= (bool) $response->moreAvailable;

// Import orders into shopsystem and add internal ids for order and orderItems in orderObject
$orders = array();
foreach ($response->orders as $apiOrder) {
$orders[] = self::importOrder($apiOrder);
}

// Set marketplace orders successfully imported in ChannelPilot
$response= $api->setImportedOrders($orders, true);

// Check if request was successful
if ($response->header->resultCode == CPResultCodes::SUCCESS) {
foreach ($apiOrders as $apiOrder) {
if ($apiOrder->header->resultCode == CPResultCodes::SUCCESS) {
// Set the cpStatus for the orders in your database to '20' (imported)
self::changeOrderStatus($apiOrder->orderHeader);
} else {
// Error in your request data for this order
}
}
} else {
// Request getNewMarketplaceOrders had no success
}
}
}
}

API-Function - GETNEWMARKETPLACEORDERS()

$response = $api->getNewMarketplaceOrders();

The response of the function "getNewMarketplaceOrders()" contains the data of a maximum of 10 marketplace orders and a hint if more orders are available. (moreAvailable = true/false).

Each of these orders is a "CPOrder" object from the php library and is a collection container for other data objects like CPHeader, CPCustomer, CPAddress, CPPayment, CPShipping, …

SOAP-UI description and samples for this function can be found here.

Sample data response:

{
"moreAvailable": false,
"countMoreAvailable": 0,
"orders": [{
"orderHeader": {
"orderIdExternal": "TEST_ORDER_ID_MARKETPLACE",
"source": "marketplace_1",
"status": {
"identifier": "10",
"publicTitle": "Warten auf Export",
"publicDescription": "The order was imported and can now be imported to the shop.",
"hasError": false
},
"orderTime": "2014-05-27T18:22:38+02:00"
},
"customer": {
"idExternal": "TEST_CUSTOMER_ID_IN_MARKETPLACE",
"genderId": 1,
"customerGroups": [{
"id": "0",
"title": "NOT LOGGED IN"
}],
"nameFirst": "Max",
"nameLast": "Mustermann",
"nameFull": "Max Mustermann",
"email": "maxmustermannsmail@testccvbnb.de",
"phone": "01234567890",
"mobile": "0160-55345234434345345",
"fax": "00492320023238237"
},
"addressInvoice": {
"genderId": 1,
"nameFirst": "Max",
"nameLast": "Mustermann",
"nameFull": "Max Mustermann",
"company": "MMC Ltd.",
"streetTitle": "Musterstr.",
"streetNumber": "1",
"streetFull": "Musterstr. 1",
"streetExtra": "c/o corporate llc",
"city": "Musterstadt",
"state": "Hamburg",
"zip": "12345",
"countryIso2": "DE",
"countryIso3": "DEU",
"phone": "01234567890"
},
"addressDelivery": {
"genderId": 1,
"nameFirst": "Max",
"nameLast": "Mustermann",
"nameFull": "Max Mustermann",
"company": "MMC Ltd.",
"streetTitle": "Musterstr.",
"streetNumber": "1",
"streetFull": "Musterstr. 1",
"streetExtra": "c/o corporate llc",
"city": "Musterstadt",
"state": "Sachsen",
"zip": "12345",
"countryIso2": "DE",
"countryIso3": "DEU",
"phone": "01234567890"
},
"itemsOrdered": [
{
"idExternal": "TEST_ITEM_ID_MARKETPLACE-1",
"article": {
"id": "GO-1003",
"idExternal": "TEST_ARTICLE_ID_MARKETPLACE_1",
"title": "Gorilla Espresso Bar Crema 1000g"
},
"quantityOrdered": 1,
"quantityDelivered": 0,
"quantityCancelled": 0,
"costsSingle": {
"net": 1.6807,
"gross": 2,
"tax": 0.3193,
"taxRate": 19
},
"costsTotal": {
"net": 1.6807,
"gross": 2,
"tax": 0.3193,
"taxRate": 19
},
"feeSingleNet": 0,
"feeTotalNet": 0
},
{
"idExternal": "TEST_ITEM_ID_MARKETPLACE-2",
"article": {
"id": "IL-3001",
"idExternal": "TEST_ARTICLE_ID_MARKETPLACE_2",
"title": "Illy Espresso Gemahlen N 250g"
},
"quantityOrdered": 2,
"quantityDelivered": 0,
"quantityCancelled": 0,
"costsSingle": {
"net": 1.4019,
"gross": 1.5,
"tax": 0.0982,
"taxRate": 7
},
"costsTotal": {
"net": 2.8037,
"gross": 3,
"tax": 0.1963,
"taxRate": 7
},
"feeSingleNet": 0,
"feeTotalNet": 0
}
],
"shipping": {
"typeId": "shippingType_1",
"typeTitle": "DHL Versand",
"costs": {
"net": 3.5499,
"gross": 4,
"tax": 0.4501,
"taxRate": 12.68
}
},
"payment": {
"typeId": "paymentType_1",
"typeTitle": "Nachnahme",
"costs": {
"net": 0,
"gross": 0,
"tax": 0,
"taxRate": 0
},
"paymentTime": "2014-05-27T18:22:38+02:00"
},
"summary": {
"totalSumItems": {
"net": 4.4844,
"gross": 5,
"tax": 0.5156,
"taxRate": 11.5
},
"totalSumOrder": {
"net": 8.0343,
"gross": 9,
"tax": 0.9657,
"taxRate": 12.02
},
"feeTotalNet": 0,
"currencyIso3": "EUR"
}
}],
"header": {
"resultCode": 200,
"resultMessage": ""
}
}

API-Function - SETIMPORTEDORDERS()

$result = $api->setImportedOrders($orders, true);

To report the successful import of orders back to Channel Pilot Pro there is the function "setImportedOrder()".

Here, the CPOrder objects from the "getNewMarketplaceOrders" response are extended by the orderId in the orderHeader and the respective id of the itemsOrdered.

NOTE: The id is not the id of the store item but the ID of the item in the order.

SOAP-UI description and samples for this function can be found here.

Sample data request:

[{
"orderHeader": {
"orderId":"TEST_ORDER_ID_SHOP",
"orderIdExternal": "TEST_ORDER_ID_MARKETPLACE",
"source": "marketplace_1",
"status": {
"identifier": "10",
"publicTitle": "Warten auf Export",
"publicDescription": "The order was imported and can now be imported to the shop.",
"hasError": false
},
"orderTime": "2014-05-27T18:22:38+02:00"
},
"itemsOrdered": [{
"id":"TEST_ITEM_ID_SHOP-1",
"idExternal": "TEST_ITEM_ID_MARKETPLACE-1",
"article": {
"id": "GO-1003",
"idExternal": "TEST_ARTICLE_ID_MARKETPLACE_1",
"title": "Gorilla Espresso Bar Crema 1000g"
}
},
{
"id":"TEST_ITEM_ID_SHOP-1",
"idExternal": "TEST_ITEM_ID_MARKETPLACE-2",
"article": {
"id": "IL-3001",
"idExternal": "TEST_ARTICLE_ID_MARKETPLACE_2",
"title": "Illy Espresso Gemahlen N 250g"
}
}]
}]

The response contains the new status (20) of the order or an error message.

Sample data response:

{
"updateResults":[{
"orderHeader":{
"orderId":"TEST_ORDER_ID_SHOP",
"orderIdExternal": "TEST_ORDER_ID_MARKETPLACE",
"source":"marketplace_1",
"status":{
"identifier":"20",
"publicTitle":"Importiert",
"publicDescription":"The order was imported and can now be imported to the shop.",
"hasError":false
},
"orderTime":"2014-06-04T12:40:11+02:00"
},
"header":{
"resultCode":200,
"resultMessage":""
}
}],
"header":{
"resultCode":200,
"resultMessage":""
}
}

Marketplace codes

Marketplace

code

alltricks (FRA)

alltricks_fra

amazon (ARE)

amazon_are

amazon (BEL)

amazon_bel

amazon (CAN)

amazon_can

amazon (DEU)

amazon.de

amazon (EGY)

amazon_egy

amazon (ESP)

amazon_esp

amazon (FRA)

amazon_fra

amazon (GBR)

amazon_gbr

amazon (IND)

amazon_ind

amazon (ITA)

amazon_ita

amazon (JPN)

amazon_jpn

amazon (MEX)

amazon_mex

amazon (NLD)

amazon_nld

amazon (POL)

amazon_pol

amazon (SAU)

amazon_sau

amazon (SWE)

amazon_swe

amazon (TUR)

amazon_tur

amazon (USA)

amazon_usa

Bol.com (NLD)

bol.nl_nl

Breuninger (DEU)

breuninger.de

Bulevip (ESP)

bulevip_esp

Carrefour (ESP)

carrefour_esp

cdiscount (FRA)

cdiscount.fra

CHECK24 Angebot (DEU)

check24.de

conrad (DEU)

conrad_deu

Decathlon (BEL)

decathlon_bel

Decathlon (CZE)

decathlon_cze

Decathlon (DEU)

decathlon_deu

Decathlon (ESP)

decathlon_esp

Decathlon (FRA)

decathlon_fra

Decathlon (GBR)

decathlon_gbr

Decathlon (HUN)

decathlon_hun

Decathlon (ITA)

decathlon_ita

Decathlon (NLD)

decathlon_nld

Decathlon (PRT)

decathlon_prt

Decathlon (ROU)

decathlon_rou

Douglas (DEU)

douglas_deu

ebay (AUS)

ebay_aus

ebay (AUT)

ebay_aut

ebay (CAN)

ebay_can

ebay (CHE)

ebay_che

ebay (DEU)

ebay.de

ebay (ESP)

ebayes_esp

ebay (FRA)

ebayfr_fra

ebay (GBR)

ebaycouk_gbr

ebay (HKG)

ebay_hkg

ebay (IND)

ebay_ind

ebay (IRL)

ebay_irl

ebay (ITA)

ebayit_ita

ebay (NLD)

ebay_nld

ebay (PHL)

ebay_phl

ebay (POL)

ebaypl_pol

ebay (SGP)

ebay_sgp

ebay (USA)

ebay_usa

El Corte Ingles (ESP)

elcorteingles_esp

Engelhorn (DEU)

engelhorn_deu

fnac (ESP)

fnac_esp

fnac (FRA)

fnac_fra

fruugo (DEU)

fruugo_deu

fruugo (ESP)

fruugo_esp

fruugo (GBR)

fruugo_gbr

Galaxus (CHE)

galaxus.ch

Galaxus (DEU)

galaxus.de

Goertz (DEU)

goertz.de

Hornbach (DEU)

hornbach_deu

kaufland.at (AUT)

kaufland_aut

kaufland.cz Nabídka (CZE)

kaufland_cze

kaufland.de Angebot (DEU)

real_deu

kaufland.fr Angebot (FRA)

kaufland_fra

kaufland.it Angebot (ITA)

kaufland_ita

kaufland.pl (POL)

kaufland_pol

kaufland.sk Ponuka (SVK)

kaufland_svk

LaRedoute Mirakl (FRA)

laredoute_fr

Leroy Merlin (FRA)

leroymerlin_fra

Leroy Merlin (ITA)

leroymerlin_ita

Leroy Merlin (PRT)

leroymerlin_prt

Leroy Merlin (ESP)

leroymerlin_esp

Limango (DEU)

limango_deu

manomano (DEU)

manomano_deu

manomano Pro (DEU)

manomanopro_deu

manomano (ESP)

manomano_esp

manomano (FRA)

manomano_fra

manomano (GBR)

manomano_gbr

manomano (ITA)

manomano_ita

MAPI amazon (DEU)

amazon.deu

MAPI amazon (FRA)

amazon.fra

MAPI amazon (ITA)

amazon.ita

MAPI amazon (GBR)

amazon.gbr

MAPI amazon (ESP)

amazon.esp

MAPI amazon (CAN)

amazon.can

MAPI amazon (USA)

amazon.usa

MAPI amazon (MEX)

amazon.mex

MAPI amazon (IND)

amazon.ind

MAPI amazon (JPN)

amazon.jpn

MAPI amazon (ARE)

amazon.are

MAPI amazon (AUS)

amazon.aus

MAPI amazon (NLD)

amazon.nld

MAPI amazon (TUR)

amazon.tur

MAPI amazon (SAU)

amazon.sau

MAPI amazon (SWE)

amazon.swe

MAPI amazon (AUT)

amazon.aut

MAPI amazon (POL)

amazon.pol

MAPI amazon (BEL)

amazon.bel

Marktkauf (DEU)

marktkauf_de

MediaMarkt/Saturn (AUT)

mediamarktsaturn_aut

MediaMarkt/Saturn (BEL)

mediamarktsaturn_bel

MediaMarkt/Saturn (DEU)

mediamarktsaturn_deu

MediaMarkt/Saturn (ESP)

mediamarktsaturn_esp

MediaMarkt/Saturn (NLD)

mediamarktsaturn_nld

Miravia (ESP)

miravia_esp

Netto (DEU)

netto_de

OnBuy (GBR)

OnBuy.com

Otto Market (DEU)

otto.de

PC-Componentes (ESP)

pccomponentes_esp

Rakuten (FRA)

rakuten.fr

Shop Apotheke (AUT)

shopapotheke_aut

Shop Apotheke (DEU)

shopapotheke_deu

Shöpping (AUT)

shoepping_at

Tradeinn (ESP)

tradeinn_esp

Trendyol (DEU)

trendyol_com

Voelkner (DEU)

voelkner_deu

Zalando (AUT)

zalando.at

Zalando (BEL)

zalando.be

Zalando (CHE)

zalando.ch

Zalando (CZE)

zalando.cz

Zalando (DEU)

zalando.de

Zalando (DNK)

zalando.dk

Zalando (ESP)

zalando.es

Zalando (FIN)

zalando.fi

Zalando (FRA)

zalando.fr

Zalando (IRL)

zalando.ie

Zalando (ITA)

zalando.it

Zalando (NLD)

zalando.nl

Zalando (NOR)

zalando.no

Zalando (POL)

zalando.pl

Did this answer your question?