checkout


This request removes all the items from the API basket and converse them into final orders.

From this point the order can not be modified anymore, part from address details.



Call parameters:


Parameter

Required

Note

uid

yes

Id client

pid

yes

Id Portal

lid

yes

id Language

key

yes

Code of authentication

api_version  

yes

Version API.

request

yes

Name of request

payment_method

no

The field "cod" obtained with the call  get_payment_method

Default 1 = Advanced Bank Transfer

cc_number

yes for credi card payment

Credit card Number

cc_exp_month

yes for credi card payment

Month Expiration

cc_exp_year

yes for credi card payment

Year Expiration

cc_ccv

yes for credi card payment

CCV/CCV2 Code


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 parameter - general part


Parameter

Always present

Note

success

yes

true o false, indicate if operation has been completed or not

rc

yes

return code.

message

yes

Error message

sent_mail

yes ( if rc != -2,-4,-14)

Outcomes of order will be send by email

sent_mail_message

yes ( if rc != -2,-4,-14)

If there is an error, this will be send by email. This field will only be present in the situation of an error, otherwise the value is ""

Items

yes ( if rc != -2,-4,-14)

Root of tree of items


This 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
  • -23 Invalid Payment Method
  • -24 Invalid Credit Card Number
  • -25 Invalid Credit Card Expiration Date
  • -26 Invalid Credit Card CCV/CCV2 code



in the situation of error -2 or -4, there will not be the fields ITEMS and details of every item



Reply parameter - detaild part



Parameter

Always present

Note

success

yes

true o false, indicate if operation has been completed or not

rc

yes

Return code.

message

yes

Error message

id_basket

yes

Indicates the basket Id number

This contains only a number when there is at least 1 product in the basket

id_order_api

yes

Indicates the API order ID



This part can have the following error messages:


  • -4  Fatal Error: There was an internal Error. Please retry or contact webmaster@wwt.it
  • -12 id_basket {0} not found. No change has been made



Json request structure:


{

  "uid"         : "12345",

  "pid"         : "2",

  "lid"         : "1",

  "key”         : "VtKpudWnzRBioQeBKQXPBdSpamppUTw8",

  "api_version" : "1.0.0",

  "request"     : "checkout",

  "payment_method" : "A",

  "cc_number"      : "378282246310005",

  "cc_exp_month"   : "05",

  "cc_exp_year"    : "2017",

  "cc_ccv"         : "1325"

}



Example of php request:



$data = array(


               "uid"             => 12345,

               "pid"             => 2,

               "lid"             => 1,

               "key"             => "VtKpudWnzRBioQeBKQXPBdSpamppUTw8",

               "api_version"     => "1.0.0",

               "request"         => "checkout",

            "payment_method"  => "A",

            "cc_number"       => "378282246310005",

            "cc_exp_month"    => "05",

            "cc_exp_year"     => "2017",

            "cc_ccv"          => "1325"

);



$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); // in $ce la risposta alla chiamata

echo $ce;

curl_close($ch);




Example of a positive response:


{

    "success": true,

    "rc": 0,

    "message": "",

    "sent_mail":true,
    "sent_mail_message":"",

    "num_rows": 3,

    "items": [{

        "success": true,

        "rc": 0,

        "message": "",

        "id_basket": "85",
        "id_order_api":"11"

    }, {

        "success": true,

        "rc": 0,

        "message": "",

        "id_basket": "86",
        "id_order_api":"12"

    }, {

        "success": true,

        "rc": 0,

        "message": "",

        "id_basket": "87",
        "id_order_api":"13"

    }]

}


Example of a negative response


Payment Error

{

    "success": false,

    "rc": -23,

    "message": "Invalid Payment Method "

}


Partial Error

{

    "success": false,

    "rc": -11,

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

    "sent_mail":true,
    "sent_mail_message":"",

    "num_rows": 3,

    "items": [{

            "success": true,

            "rc": 0,

            "message": "",

            "id_basket": "85",
            "id_order_api":"11"

        }, {

            "success": true,

            "rc": 0,

            "message": "",

            "id_basket": "86",
            "id_order_api":"12"

        }, {

            "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: Full-featured Kindle eBooks generator