Add Orders

From KartRocket API
Jump to: navigation, search

Add Order

Request

User can create order by sending a HTTP POST Request on the following URL.


YOUR_STORE_URL_ON_KARTROCKET.'index.php?route=feed/web_api/addorder&key='.WEB_API_KEY;

Example

http://api.kartrocket.co/index.php?route=feed/web_api/addorder&key=APITEST;

Following is the JSON data format to be posted on above URL.

$params is the array consisting JSON data to create order. Index ‘data’ is critical for the system.


$params[‘data’] = {
   "import_order_id":"1234567890", #Reference Order Id, Not Required. 
   "channel_id":"X",   #Integer. To be used only in case you are a market place. Contact Kartrocket for channel IDs.
   "firstname":"Albert",
   "lastname":"Pinto",
   "email":"albert.pinto@xyz.com",
   "company":"",
   "address_1":"Address Line 1",
   "address_2":" Address Line 2",
   "city":"Shipment City",
   "postcode":" Shipment Postcode",
   "state":" Shipment State ",
   "country_code":"IN",
   "telephone":"98XXXXXXXX", #Ten digit only.
   "mobile":"98XXXXXXXX", #Required. Ten digit only.
   "fax":"98XXXXXXXX ", #Ten digit only.
   "payment_method":" Payment Method",  #Payment Method text.
   "payment_code":"Payment Code",   # In case of Cash on Delivery order, the value here should be 'cod' else anything.
   "shipping_method":"Shipment Method", #Shipment Method text.
   "shipping_code":"Shipment Code",  # Free text.
   "order_status_id":"1", #Check Appendix:Order Status Codes.
   "products":[
      {
         "name":"Apple iPhone 4Sx",
         "model":"MB0010",
         "sku":"MB0010",
         "quantity":1,
         "subtract":1,
         "price":145,
         "total":145,
         "tax":6.9047619047619,
         "reward":0
      },
      {
         "name":"Apple iPhone 4C",
         "model":"MB0011",
         "sku":"MB0011",
         "quantity":1,
         "subtract":1,
         "price":145,
         "total":145,
         "tax":6.9047619047619,
         "reward":0
      }
   ],
   "totals":{
      "handling":44,
      "low_order_fee":77,
      "sub_total":145,
      "tax":7,
      "total":266
   },
   "weight":1,
   "weight_unit":"kg",   #Accepted Values : kg,g 
   "comment":"",
   "total":266
}

Response

If your request was successful and order was created.
{
   "success":true,
   "order_added":{
      "status":"Order created successfully",
      "order_id":"513"
   }
}
If your request was unsuccessful because of some error or data problem.
{
   "success":false,
   "error":"Respective Error Message."
}



Parameters Description

key : API Key provided by KartRocket.(Required)


Sample File

[View Sample on Github]

Appendix

Order Status Codes
Code Description
1 Pending
3 Shipped
5 Complete
7 Canceled
10 ePayment Failed
17 COD Confirmed
18 Ready for Dispatch
19 ePayment Received
20 Returned
21 Cancelled Against New
22 RTO Initiated-Logistics Partner
23 RTO Initiated-Customer
24 RTO Received-Logisitics Partner
25 RTO Received-Customer
26 Lost/Stolen
27 Delivered
28 Pick Up Generated