Shoptrader API docs

Image Description

Get - Orders

Met deze API is het mogelijk om orders uit te lezen

Parameters

Parameter Type Verplicht Omschrijving
token string Ja Token, wordt verstrekt door Shoptrader op verzoek
orders_status_id array Nee Standaard leeg, geen filtering op orderstatus. Via GET > Orderstatus kunnen de orderstatussen uitgelezen worden.
customer_id integer Nee Om alle orders van die customer_id te zien
order_date_from date Nee Alle orders vanaf een bepaalde order datum laten zien
order_date_to date Nee Alle orders tot een bepaalde order datum laten zien. Let op: order_date_from moet hiervoor ook gevuld zijn
last_modified_from date Nee Alle orders die gewijzigd zijn te laten zien vanaf de datum. Let op werkt alleen als order_date_from niet gevuld is
last_modified_to date Nee Alle orders die gewijzigd zijn te laten zien tot de datum. Let op: last_modified_from moet hiervoor ook gevuld zijn
limit integer Nee Stel een limiet in, bijvoorbeeld de laatste 10, gebruik all voor alle orders, indien leeg standaard de laatste 100
offset integer Nee Stel een offset in, om bijvoorbeelde de volgende 10 op te halen, indien leeg standaard 0

PHP Example

<?php
ini_set
('max_execution_time'0);

$strApiBaseUrl 'uwdomeinnaam.uwdomeinextentie';
$strOutput 'xml';
$strUrl 'http://' $strApiBaseUrl '/Api/Get/Orders/?' $strOutput;        

// standaard parameters
$arrParams = array();
$arrParams['token']         = '8f00f89310945a0ca35666c8c9ced2e314e37aa6c32e900932e19902b42208767';

// custom parameters
$arrParams['orders_status_id']     = array(90119012);
$arrParams['limit']             = 100;
// $arrParams['customer_id']         = 1;
// $arrParams['last_modified_from'] = '18-01-2016' // '18-01-2016 12:00:00';
// $arrParams['last_modified_to'] = '18-01-2016';  // '18-01-2016 12:05:00';
// $arrParams['order_date_from'] = '18-01-2016';   // '18-01-2016 12:00:00';
// $arrParams['order_date_to'] = '18-01-2016';     // '18-01-2016 12:05:00';

$objCurl curl_init();
curl_setopt($objCurlCURLOPT_URL$strUrl);
curl_setopt($objCurlCURLOPT_RETURNTRANSFERtrue);
curl_setopt($objCurlCURLOPT_TIMEOUT30);
curl_setopt($objCurlCURLOPT_USERAGENT'Shoptrader');
curl_setopt($objCurlCURLOPT_POSTtrue);
curl_setopt($objCurlCURLOPT_POSTFIELDShttp_build_query($arrParams));

// execute cURL, array, xml output
$strCurlData curl_exec($objCurl);
if (
$strCurlData === FALSE) {
    echo 
"cURL Error: " curl_error($objCurl);
} else {
    
print_r($strCurlData);
}

// execute cURL, array, xml output
// $strCurlData = curl_exec($objCurl);
// if ($strCurlData === FALSE) {
//    echo "cURL Error: " . curl_error($objCurl);
// } else {
//    $arrShopResult = json_decode($strCurlData, true);
//    print_r($arrShopResult);
// }
?>

Resultaat (array)

Alle prijzen zijn exclusief BTW

<?php
Array(
    [
order] => Array(
        [
1] => Array(
            [@
attributes] => Array(
                [
order_id] => 16335
            
)

            [
info] => Array(
                [
orders_language] => dutch
                
[payment_method] => Bancontact MisterCash
                
[payment_status] => paid
                
[last_modified] => 2016-01-06 22:43:59
                
[date_purchased] => 2016-01-06 22:42:27
                
[orders_status] => Pay.nl [PAID]
                [
currency] => EUR
                
[currency_value] => 1.000000
                
[shipping_module] => bpost_bpost
                
[invoice_number] => 0
                
[invoice_serial] => 0
                
[restocked] => 0
                
[invoice_comment] => 
                [
orders_retournummer] => 
                [
track_number] => 
            )
            [
order_totals] => Array (
                [
order_total] => Array (
                    [
0] => Array (
                        [@
attributes] => Array (
                            [
order_total_id] => 56419
                        
)
                        [
title] => Subtotaal:
                        [
value_ex] => 28.1499
                        
[tax] => 0
                        
[value_in] => 28.1499
                        
[class] => ot_subtotal
                        
[sort_order] => 1
                    
)
                    [
1] => Array (
                        [@
attributes] => Array (
                            [
order_total_id] => 56420
                        
)
                        [
title] => Coupon code KORTING10 korting:
                        [
value_ex] => -2.3264
                        
[tax] => 21
                        
[value_in] => -2.8112
                        
[class] => ot_discount_coupon
                        
[sort_order] => 2
                    
)
                    [
2] => Array (
                        [@
attributes] => Array (
                            [
order_total_id] => 56421
                        
)

                        [
title] => B Post (4-5 dagen):
                        [
value_ex] => 7.0248
                        
[tax] => 21
                        
[value_in] => 8.5000
                        
[class] => ot_shipping
                        
[sort_order] => 3
                    
)
                    [
3] => Array (
                        [@
attributes] => Array (
                            [
order_total_id] => 56422
                        
)
                        [
title] => Totaal:
                        [
value_ex] => 33.8349
                        
[tax] => 0
                        
[value_in] => 33.8349
                        
[class] => ot_total
                        
[sort_order] => 10
                    
)
                    [
4] => Array (
                        [@
attributes] => Array (
                            [
order_total_id] => 56423
                        
)
                        [
title] => Berekende Btw 21%:
                        [
value_ex] => 5.8722
                        
[tax] => 0
                        
[value_in] => 5.8722
                        
[class] => ot_tax
                        
[sort_order] => 11
                    
)
                )
            )
            [
customer] => Array(
                [@
attributes] => Array(
                    [
customer_id] => 886
                
)
                [
customers_name] => Support Shoptrader
                
[customers_company] => 
                [
customers_btw_nummer] => 
                [
customers_kvk_nummer] => 
                [
customers_street_address] => Wilgenweg
                
[customers_suburb] => 26
                
[customers_huisnrtoevoeging] => B
                
[customers_city] => Amsterdam
                
[customers_postcode] => 1031 HV
                
[customers_state] => 
                [
customers_country] => Nederland
                
[customers_telephone] => 0207771322
                
[customers_email_address] => support@shoptrader.nl
                
[customers_dummy_account] => 0
            
)
            [
delivery] => Array(
                [
delivery_name] => Support Shoptrader
                
[delivery_company] => 
                [
delivery_btw_nummer] => 
                [
delivery_kvk_nummer] => 
                [
delivery_street_address] => Wilgenweg
                
[delivery_suburb] => 26
                
[delivery_huisnrtoevoeging] => B
                
[delivery_city] => Amsterdam
                
[delivery_postcode] => 1031 HV
                
[delivery_state] => 
                [
delivery_country] => Nederland
            
)
            [
billing] => Array(
                [
billing_name] => Support Shoptrader
                
[billing_company] => 
                [
billing_btw_nummer] => 
                [
billing_kvk_nummer] => 
                [
billing_street_address] => Wilgenweg
                
[billing_suburb] => 26
                
[billing_huisnrtoevoeging] => B
                
[billing_city] => Amsterdam
                
[billing_postcode] => 1031 HV
                
[billing_state] => 
                [
billing_country] => Nederland
            
)
            [
order_products] => Array(
                [
order_product] => Array(
                    [
1] => Array(
                        [@
attributes] => Array(
                            [
order_product_id] => 49176
                        
)
                        [
products_id] => 5062
                        
[products_name] => Test artikel 1
                        
[products_price] => 4.0496
                        
[final_price] => 4.0496
                        
[products_tax] => 21
                        
[products_returned] => 0
                        
[products_graveer_text] => 
                        [
products_uploaded_image] => 
                        [
products_quantity] => 1
                        
[attributes] => Array(
                            [
attribute] => Array(
                                [
1] => Array(
                                    [@
attributes] => Array(
                                        [
order_products_attributes_id] => 15
                                    
)
                                    [
products_options] => Maat
                                    
[products_options_values] => 32/32
                                    
[options_values_price] => 4.1322
                                    
[price_prefix] => +
                                )
                                [
2] => Array(
                                    [@
attributes] => Array(
                                        [
order_products_attributes_id] => 16
                                    
)
                                    [
products_options] => Kleur
                                    
[products_options_values] => blauw
                                    
[options_values_price] => 5.7851
                                    
[price_prefix] => +
                                )
                            )
                        )
                        [
products_stock_quantity] => 14
                        
[products_stock_article_nr] => bl_32
                        
[products_stock_sku] => sku_bl_32
                        
[products_stock_ean] => ean_bl_32
                    
)
                    [
2] => Array(
                        [@
attributes] => Array(
                            [
order_product_id] => 49177
                        
)
                        [
products_id] => 5062
                        
[products_name] => Test artikel 1
                        
[products_price] => 0.8264
                        
[final_price] => 13.2231
                        
[products_tax] => 21
                        
[products_returned] => 0
                        
[products_graveer_text] => 
                        [
products_uploaded_image] => 
                        [
products_quantity] => 1
                        
[attributes] => Array(
                            [
attribute] => Array(
                                [
1] => Array(
                                    [@
attributes] => Array(
                                        [
order_products_attributes_id] => 17
                                    
)
                                    [
products_options] => Maat
                                    
[products_options_values] => 32/32
                                    
[options_values_price] => 4.1322
                                    
[price_prefix] => +
                                )

                                [
2] => Array(
                                    [@
attributes] => Array(
                                        [
order_products_attributes_id] => 18
                                    
)

                                    [
products_options] => Kleur
                                    
[products_options_values] => rood
                                    
[options_values_price] => 8.2645
                                    
[price_prefix] => +
                                )
                            )
                        )
                    )
                )
            )
                    
                    [
shipingData] => Array(
                                [
postnl_checkout] => Array(
                                    [
orders_postnl_id] => '123'
                                    
[orders_id] => '1234'
                                    
[customers_id] => '4290'
                                    
[mainbarcode] => 'A BARCODE'
                                    
[barcodes] => 'A BARCODE'
                                    
[shipping] => 'a shipping method'
                                    
[optie_type] => 'bezorgen'
                                    
[soort] => 'Overdag'
                                    
[datum] => '2017-08-26'
                                    
[van] => '11:00:00'
                                    
[tot] => '13:00:00'
                                    
[verzenddatum] => 
                                    [
kosten_excl] => '0.00'
                                    
[kosten_btw] => '0'
                                    
[locatiecode] => 'timeframe_8'
                                    
[bedrijf] => 
                                    [
voornaam] => 'voornaam'
                                    
[achternaam] => 'achternaam'
                                    
[straat] => 'straat'
                                    
[huisnr] => 'huisnr'
                                    
[huisnr_toevoeging] => 
                                    [
postcode] => '8925AA'
                                    
[stad] => 'Leeuwarden'
                                    
[landcode] => 'Leeuwarden'
                                    
[telefoon] => '0612345678'
                                    
[opmerking] => 
                                    [
datum_toegevoegd] => '2017-08-20 16:55:16'
                                    
[ip_adres] => 'an ip'
                                    
[status] => '1'
                                
)
                        )
        )
    )
)
?>