add_items_to_basket


This request allows you to add products and customer details into the API basket.



Call parameters:


Parameter

Required

Note

uid

yes

Id client

pid

yes

Id Portal

lid

yes

id Language

key

yes

Identification code

api_version  

yes

Version API.

request

yes

Name of function request

items

yes

Root of the tree that contains the item requested

    id_product

yes

Id product required by request get_brand_items

    qty

yes

Qty requested

    user_id_order

no

User id of customer order

    user_id_user

no

id final client

    user_company_name

no

Title of final customer (Mr., Ms., etc..  )

    user_first_name

no

First name of final customer

    user_last_name

no

Last name of final customer

    user_address

no

Address of final customer

    user_city

no

City of final customer

    user_country

no

Country of final customer . You can only use the values contained into the field COD of get_shipping_country message

    user_zipcode

no

ZIP code of final customer

    user_state

no

Province of final customer

    user_phone

no

Telephone of final customer

    user_mobile

no

Mobile of final customer

    user_mail

no

Email of final customer

    user_retail_price

no

Retail price

    user_discount

no

Discount final customer

    user_price

no

Price final customer

    user_cod

no

Payment at delivery (Cash on Delivery). Two values possible:

  • 1 - Yes
  • 0 - No

Default : 0

    user_note

no

Note added by final customer

    internal_note

no

Note added by reseller


Fields that are not Required are orders placed without additional messages, normal orders.

If a partner wants to use our dropshipping interface the fields that are not Required will be necessary to complete.


Fields messages must be sent encoded in base64 code in order to prevent problems of interpretation in Json structure.

In the event they are not, the API will provide it.

However, these fields (user_note and internet_note) will be based on base64.




Reply parameters:


This result will be devided in two parts:

  • General part which determines whether the entire process of data entry into the basket went well
  • Details: which shows the outcomes of every request, including the inclusion into the DB. These results will be encapsulated in the parent node "items"



Reply parameters - general part:


Parameter

Always present

Note

success

yes

true o false, indicate if ALL operations been completed or not.

rc

yes

return code.

message

yes

Error message


This call part can have the following error messages:


  • -2  Access Denied
  • -4  Fatal Error: There was an internal Error. Please retry or contact webmaster@wwt.it
  • -11 One or more errors occurred while processing your request.
  • -14 Unable to proceed. User does not have permission to perform this action
  • -20 user_cod must be 0 or 1


In the situation of -2 or -4, there will not be the field 'items' and also no details of every single product



Reply parameters - details of every item:


Parameter

Always present

Note

success

yes

true o false,  indicate if operations been completed or not.

rc

yes

return code.

message

yes

Error message

id_basket

       

yes

Specifies the id reference in the API basket

Is value only when it was possible to add at least one reference into the basket

id_product

yes

id of product added to the basket

qty_requested

yes

Qty requested

qty_available

yes

New qty available after reservation of product into the API basket

minimum_qty

yes

Minimum qty necessary to proceed with the placement of the product into the basket.

This value can be found in the field of "min_qty" from the function get_brands.

qty_reserved

yes

Qty reserverd. This value can be less than the qty_requested if:

  • qty_request < min_qty ,  but in the warehouse we have only N products that are less than  min_qty  and qty_request => N
  • qty_request > stock

retail_price

yes

Retail price

discount

yes

Discount

price

yes

Price

extra_discount

yes

Extra discount in the situation of complying to the rule

extra_discount_threshold_value

net_price

yes

Price after extra discount. This value is at leat the same as price, even as extra_discount = 0


This call part can have the following error messages:


  • -2 Access Denied
  • -4 Fatal Error: There was an internal Error. Please retry or contact webmaster@wwt.it
  • -7 It was not possible to reserve item(s). Item is out of stock
  • -8 It was not possible to reserve item(s). Minimum quantity is not reached
  • -9 Minimum quantity not reached but {0} item(s) inserted for out of stock
  • -10 The requested quantity is not available in stock. Only {0} item(s) was reserved.




Json request structure:


{

    "uid": 12345,

    "pid": 2,

    "lid": 1,

    "key": "VtKpudWnzRBioQeBKQXPBdSpamppUTw8",

    "api_version": "1.0.0",

    "request": "add_items_to_basket",

    "items": [{

        "id_product": 110032,

        "qty": 1,

        "user_id_order": 22,

        "user_id_user": 33,

        "user_company_name": "Ms.",

        "user_first_name": "Matilda",

        "user_last_name": "Dale",

        "user_address": "10 Horner Street",

        "user_city": "Akron",

        "user_country": "OH",

        "user_zipcode": "44307",

        "user_state": "United States",

        "user_phone": "330-977-0601",

        "user_mobile": "330-977-0602",

        "user_mail": "MatildaDale@rhyta.com",

        "user_retail_price": 1000,

        "user_discount": 50.3,

        "user_price": 497,

        "user_cod": 1,

        "user_note": "dGVzdG8gY2xpZW50ZQ==",

        "internal_note": "dGVzdG8gZXNlcmNlbnRl"

    }, {

        "id_product": 51788,

        "qty": 14,

        "user_id_order": 22,

        "user_id_user": 33,

        "user_company_name": "Mr.",

        "user_first_name": "Arabella",

        "user_last_name": "Palermo",

        "user_address": "Bayreuther Strasse 14",

        "user_city": "Offenbach",

        "user_country": "am",

        "user_zipcode": "63073",

        "user_state": "Germany",

        "user_phone": "069 82 66 04",

        "user_mobile": "069 82 66 07",

        "user_mail": "ArabellaPalermo@dayrep.de",

        "user_retail_price": 1000,

        "user_discount": 50.3,

        "user_price": 497,

        "user_cod": 0,

        "user_note": "dGVzdG8gY2xpZW50ZQ==",

        "internal_note": "dGVzdG8gZXNlcmNlbnRl"

    }, {

        "id_product": 105108,

        "qty": 1,

        "user_id_order": 22,

        "user_id_user": 33,

        "user_company_name": "Intervals s.a.r.l.",

        "user_first_name": "Melvin",

        "user_last_name": "Jansson",

        "user_address": "Avda. Alameda Sundheim, 72",

        "user_city": "Binaced",

        "user_country": "",

        "user_zipcode": "22510",

        "user_state": "Spain",

        "user_phone": "974 313 352",

        "user_mobile": "974 313 687",

        "user_mail": "MelvinJansson@jourrapide.com",

        "user_retail_price": 1000,

        "user_discount": 50.3,

        "user_price": 497,

        "user_cod": 0,

        "user_note": "dGVzdG8gY2xpZW50ZQ==",

        "internal_note": "dGVzdG8gZXNlcmNlbnRl"

    }]

}



Example of php request:



$data = array(

    "uid"          => 12345,

    "pid"          => 2,

    "lid"          => 1,

    "key"          => "VtKpudWnzRBioQeBKQXPBdSpamppUTw8",

    "api_version" => "1.0.0",

    "request"     => "add_items_to_basket",

    "items"    => array(

        array(

            'id_product'         => 110032,

            'qty'                => 1,

            'user_id_order'      => 22,

            'user_id_user'       => 33,

            'user_company_name'  => 'Ms',

            'user_first_name'    => 'Matilda',

            'user_last_name'     => 'Dale',

            'user_address'       => '10 Horner Street',

            'user_city'          => 'Akron',

            'user_country'       => 'OH',

            'user_zipcode'       => '44307',

            'user_state'         => 'United States',

            'user_phone'         => '330-977-0601',

            'user_mobile'        => '330-977-0602',

            'user_mail'          => 'MatildaDale@rhyta.com',

            'user_retail_price'  => 1000,

            'user_discount'      => 50.30,

            'user_price'         => 497,

            'user_cod'           => 1,

            'user_note'          => base64_encode('testo cliente'),

            'internal_note'      => base64_encode('testo esercente')

        ) ,

        array(

            'id_product'         => 51788,

            'qty'                => 14,

            'user_id_order'      => 22,

            'user_id_user'       => 33,

            'user_company_name'  => 'Mr.',

            'user_first_name'    => 'Arabella',

            'user_last_name'     => 'Palermo',

            'user_address'       => 'Bayreuther Strasse 14',

            'user_city'          => 'Offenbach',

            'user_country'       => 'am',

            'user_zipcode'       => '63073',

            'user_state'         => 'Germany',

            'user_phone'         => '069 82 66 04',

            'user_mobile'        => '069 82 66 07',

            'user_mail'          => 'ArabellaPalermo@dayrep.de',

            'user_retail_price'  => 1000,

            'user_discount'      => 50.30,

            'user_price'         => 497,

            'user_cod'           => 0,

            'user_note'          => base64_encode('testo cliente'),

            'internal_note'      => base64_encode('testo esercente')


        ),

        array(

            'id_product'         => 105108,

            'qty'                => 1,

            'user_id_order'      => 22,

            'user_id_user'       => 33,

            'user_company_name'  => 'Intervals s.a.r.l.',

            'user_first_name'    => 'Melvin',

            'user_last_name'     => 'Jansson',

            'user_address'       => 'Avda. Alameda Sundheim, 72',

            'user_city'          => 'Binaced',

            'user_country'       => '',

            'user_zipcode'       => '22510',

            'user_state'         => 'Spain',

            'user_phone'         => '974 313 352',

            'user_mobile'        => '974 313 687',

            'user_mail'          => 'MelvinJansson@jourrapide.com',

            'user_retail_price'  => 1000,

            'user_discount'      => 50.30,

            'user_price'         => 497,

            'user_cod'           => 0,

            'user_note'          => base64_encode('testo cliente'),

            'internal_note'      => base64_encode('testo esercente')

        )

    )

);



$data = array('data' => json_encode($data));

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://dev.dropshippingb2b.com/api/");

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,2);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$ce = curl_exec($ch);


echo $ce;


curl_close($ch);






Example of a positive response:


{

    "success": false,

    "rc": -11,

    "message": "One or more errors occurred while processing your request.",

    "items": [{

        "success": true,

        "rc": 0,

        "message": "",

        "id_basket": 9,

        "id_product": 110032,

        "qty_requested": 1,

        "qty_available": 41,

        "minimum_qty": "0",

        "qty_reserved": 1,

        "retail_price": "39.00",

        "discount": "65.00",

        "price": "13.65",

        "extra_discount": "0",

        "net_price": "13.65"

    },{

        "success": false,

        "rc": -10,

        "message": "The requested quantity is not available in stock. Only 10 item(s) was reserved.",

        "id_basket": 13,

        "id_product": 51788,

        "qty_requested": 14,

        "qty_available": 0,

        "minimum_qty": "0",

        "qty_reserved": 10,

        "retail_price": "190.00",

        "discount": "70.00",

        "price": "57.00",

        "extra_discount": "0",

        "net_price": "57.00"

    },{

        "success": false,

        "rc": -7,

        "message": "It was not possible to reserve item(s). Item is out of stock",

        "id_basket": 0,

        "id_product": 105108,

        "qty_requested": 1,

        "qty_available": "0",

        "minimum_qty": "0",

        "qty_reserved": 0,

        "retail_price": "45.00",

        "discount": "48.91",

        "price": "22.99",

        "extra_discount": "0",

        "net_price": "22.99"

    }]

}



A possible negative response:


{

  "success": false,

  "rc": -4,

  "messageā€: "Fatal Error: There was an internal Error. Please retry or contact webmaster@wwt.it"

}











































Created with the Personal Edition of HelpNDoc: Free EBook and documentation generator