Zum Hauptinhalt springen

Bestellungen via Seller-API

Bestellungen importieren

Während dieses Prozesses werden Bestellungen für den Shop abgerufen und der erfolgreiche Bestellimport an Channel Pilot Pro gemeldet. Dabei werden Bestellnummer und Bestellartikelnummern an Channel Pilot Pro übertragen.

Beispielimplementierung des Bestellimports:

// 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-Funktion- GETNEWMARKETPLACEORDERS()

$response = $api->getNewMarketplaceOrders();

Der Response der Funktion "getNewMarketplaceOrders()" enthält die Daten von maximal 10 Marktplatzbestellungen (orders) und einen Hinweis ob mehr Bestellungen verfügbar sind (moreAvailable = true/false).

Jede dieser Bestellungen ist ein "CPOrder-Objekt" aus der php-Library und ist ein Sammelcontainer für weitere Datenobjekte wie CPHeader, CPCustomer, CPAddress, CPPayment, CPShipping, …

Beispieldaten Response:

{
"moreAvailable": false,
"countMoreAvailable": 0,
"orders": [{
"orderHeader": {
"orderIdExternal": "TEST_ORDER_ID_MARKETPLACE",
"source": "marketplace_1",
"status": {
"identifier": "10",
"publicTitle": "Warten auf Export",
"publicDescription": "Die Bestellung wurde importiert und kann nun vom Shop abgeholt werden.",
"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-Funktion- SETIMPORTEDORDERS()

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

Um den erfolgreichen Import der Bestellungen an ChannelPilot zurückzumelden gibt es die Funktion "setImportedOrder()".

Hierbei werden die "CPOrder-Objekte" aus dem "getNewMarketplaceOrders"-Response um die orderId im orderHeader und die jeweilige id der itemsOrdered erweitert.

HINWEIS: Bei der id handelt es sich nicht um die Id des Shop Artikels sondern um die Id des Artikels in der Bestellung.

Beispieldaten Request:

[{
"orderHeader": {
"orderId":"TEST_ORDER_ID_SHOP",
"orderIdExternal": "TEST_ORDER_ID_MARKETPLACE",
"source": "marketplace_1",
"status": {
"identifier": "10",
"publicTitle": "Warten auf Export",
"publicDescription": "Die Bestellung wurde importiert und kann nun vom Shop abgeholt werden.",
"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"
}
}]
}]

Im Response befindet sich der neue status (20) der Bestellung oder eine Fehlermeldung.

Beispieldaten Response:

{
"updateResults":[{
"orderHeader":{
"orderId":"TEST_ORDER_ID_SHOP",
"orderIdExternal": "TEST_ORDER_ID_MARKETPLACE",
"source":"marketplace_1",
"status":{
"identifier":"20",
"publicTitle":"Importiert",
"publicDescription":"Die Bestellung wurde vom Shop importiert. Sie sollte nun versendet werden.",
"hasError":false
},
"orderTime":"2014-06-04T12:40:11+02:00"
},
"header":{
"resultCode":200,
"resultMessage":""
}
}],
"header":{
"resultCode":200,
"resultMessage":""
}
}

MARKTPLATZ CODES

Marktplatz

code

aboutyou (DEU)

aboutyou_deu

Allegro (POL)

allegro_pl

alltricks (FRA)

alltricks_fra

AUTODOC (AUT)

autodoc_aut

AUTODOC (DEU)

autodoc_deu

AUTODOC (ESP)

autodoc_esp

AUTODOC (FRA)

autodoc_fra

Bauhaus (DEU)

bauhaus_deu

bol.com (NLD)

bolcom_nld

Bol.com (NLD)

bol.nl_nl

Breuninger (DEU)

breuninger.de

Bulevip (ESP)

bulevip_esp

BUT (FRA)

but_fra

Carrefour (ESP)

carrefour_esp

Carrefour (FRA)

carrefour_fra

Cdiscount (MAPI) (FRA)

cdiscount.fra

CHECK24 Angebot (DEU)

check24.de

conrad (Legacy - Platform Model) (AUT)

conrad_aut

conrad (Legacy - Platform Model) (FRA)

conrad_fra

conrad (Legacy - Platform Model) (ITA)

conrad_ita

conrad (New - Dropship Model) (AUT)

conrad_dropshipping_aut

conrad (New - Dropship Model) (DEU)

conrad_dropshipping_deu

conrad (New - Dropship Model) (FRA)

conrad_dropshipping_fra

conrad (New - Dropship Model) (NLD)

conrad_dropshipping_nld

Decathlon (BEL)

decathlon_bel

Decathlon (CHE)

decathlon_che

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 (IRL)

decathlon_irl

Decathlon (ITA)

decathlon_ita

Decathlon (NLD)

decathlon_nld

Decathlon (POL)

decathlon_pol

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

ePRICE (ITA)

eprice_ita

fnac (ESP)

fnac_esp

Fressnapf (DEU)

fressnapf_deu

fruugo (DEU)

fruugo_deu

fruugo (ESP)

fruugo_esp

fruugo (GBR)

fruugo_gbr

Galaxus (CHE)

galaxus.ch

Galaxus (DEU)

galaxus.de

Galeria (DEU)

galeria_deu

Heyconnect (DEU)

heyconnect_deu

Home24 (AUT)

home24_aut

Home24 (DEU)

home24_deu

Hornbach (DEU)

hornbach_deu

kaufland.at Angebot (AUT)

kaufland_aut

kaufland.cz Nabídka (CZE)

kaufland_cze

kaufland.de Angebot (DEU)

real_deu

Kaufland.es Angebot (ESP)

kaufland_esp

Kaufland.fr Angebot (FRA)

kaufland_fra

Kaufland.it Angebot (ITA)

kaufland_ita

Kaufland.nl Angebot (NLD)

kaufland_nld

kaufland.pl Oferta (POL)

kaufland_pol

kaufland.sk Ponuka (SVK)

kaufland_svk

LaRedoute Mirakl (FRA)

laredoute_fr

Leroy Merlin (ESP)

leroymerlin_esp

Leroy Merlin (FRA)

leroymerlin_fra

Leroy Merlin (ITA)

leroymerlin_ita

Leroy Merlin (PRT)

leroymerlin_prt

Leroy Merlin EUR (POL)

leroymerlineur_pol

Leroy Merlin PLN (POL)

leroymerlinpln_pol

Limango (DEU)

limango_deu

Limango Mirakl (DEU)

limangomirakl_deu

locamo (DEU)

locamo_deu

Maisons du monde (FRA)

maisonsdumonde_fra

manomano (DEU)

manomano_deu

manomano (ESP)

manomano_esp

manomano (FRA)

manomano_fra

manomano (GBR)

manomano_gbr

manomano (ITA)

manomano_ita

manomano Pro (DEU)

manomanopro_deu

MAPI amazon (ARE)

amazon.are

MAPI amazon (AUS)

amazon.aus

MAPI amazon (BEL)

amazon.bel

MAPI amazon (CAN)

amazon.can

MAPI amazon (DEU)

amazon.deu

MAPI amazon (ESP)

amazon.esp

MAPI amazon (FRA)

amazon.fra

MAPI amazon (GBR)

amazon.gbr

MAPI amazon (IND)

amazon.ind

MAPI amazon (IRL)

amazon.irl

MAPI amazon (ITA)

amazon.ita

MAPI amazon (JPN)

amazon.jpn

MAPI amazon (MEX)

amazon.mex

MAPI amazon (NLD)

amazon.nld

MAPI amazon (POL)

amazon.pol

MAPI amazon (SAU)

amazon.sau

MAPI amazon (SWE)

amazon.swe

MAPI amazon (TUR)

amazon.tur

MAPI amazon (USA)

amazon.usa

Marktkauf (DEU)

marktkauf_de

Media World (ITA)

mediaworld_ita

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

OBI (DEU)

obi_deu

OnBuy (GBR)

OnBuy.com

Otto Market (DEU)

otto.de

Payback (DEU)

payback_deu

PC-Componentes (ESP)

pccomponentes_esp

Rakuten (FRA)

rakuten.fr

RETIF (FRA)

retif_fra

Shein (DEU)

shein_de

Shop Apotheke (AUT)

shopapotheke_aut

Shop Apotheke (DEU)

shopapotheke_deu

SHOP.COM (GBR)

shopcom_gbr

Shöpping (AUT)

shoepping_at

Spartoo (DEU)

spartoo_deu

Spartoo (ESP)

spartoo_esp

Spartoo (FRA)

spartoo_fra

Spartoo (GBR)

spartoo_gbr

Teract (FRA)

teract_fra

TikTok Shop (DEU)

tiktokshop_deu

TikTok Shop (ESP)

tiktokshop_esp

TikTok Shop (FRA)

tiktokshop_fra

Trendyol (DEU)

trendyol_com

Vente-unique (PRT)

venteunique_prt

Vertbaudet (DEU)

vertbaudet_deu

Voelkner (DEU)

voelkner_deu

Worten (ESP)

worten_esp

Worten (PRT)

worten_prt

XXXLutz.de (DEU)

xxxlutzde_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 (GBR)

zalando.gb

Zalando (IRL)

zalando.ie

Zalando (ITA)

zalando.it

Zalando (NLD)

zalando.nl

Zalando (NOR)

zalando.no

Zalando (POL)

zalando.pl

Zalando (PRT)

zalando.pt

Zalando (SVK)

zalando.sk

Zalando (SVN)

zalando.si

Zalando (SWE)

zalando.se

Zalando marketplace (HRV)

zalando.hr

Zooplus (DEU)

zooplus_deu

Zooplus (FRA)

zooplus_fra

Hat dies deine Frage beantwortet?