Orders

(ms.orders)

Orders section lets you manage and perform operations on your orders.



Fields

ValueDescription
order_id   
Type: string
The unique id of order.

It is made up of two parts: 
Prefix: Order id prefix is retrieved from settings.
Sequence number: It is an auto generated numeric sequence.
OID100
OID: prefix
100: sequence number
items   
Type: array
It is an array of object which stores details of products in the cart.
_id
Type: string
The unique numeric identifier for the product in the cart.
59d605da64abe444540ee6e0
name
Type: string
Name of the product.
Mustard sweater
product_id
Type: string
Unique id of the product.
product_url
Type: string
The URL of the product page.
weight
Type: string
The weight of the product.
variant_id
Type: string
Variant id of the selected product.
red|l
seller
Type: string
Seller id of the product.
5ad0a0779a4cbc2439988840
linked_product_id
Type: string
Id of linked product (if any).
null
price
Type: string
Price of the product.
list_price
Type: number
Listing price of the product.
discounts_percentage
Type: string
The percentage of the discount applied.
discounts_total
Type: string
Total discounted amount applied.
discounts
Type: array
An array of object that contains details of discount applied on product.
taxes_total
Type: number
Total tax amount applied.
shipping_cost
Type: number
The shipping cost applied on the order.
discount_total
Type: string
quantity
Type: number
The quantity of the items in the cart.
total
Type: number
payment_method   
Type: object
The object contains the information of payment method used for placing the order.
{
  payment_method:
	{"_id": "541fd019360299ca6d08581f",
	"type": "cash_on_delivery",
	"enabled": "1",
	"settings": {
		"message": "COD",
		"check_availablity": true,
		"userinput": false,
		"form_name": "",
		"validate": false,
		"validation_source": "sms"
		},
	"name": "Cash on Delivery",
	"check_availablity": "0",
	"alias": "cash-on-delivery",
	"updated_on": "2018-03-26T09:37:18.639Z",
	"_updated_by": "58a3fba935a5cdff1784e5e2",
	"additional_charges": 99,
	"sort_order": 0,
	"conditions": []
    }
}
name
Type: string
Name of the payment method.
Cash On Delivery
enabled
Type: string
A flag variable that determines whether payment method is applied or not.
settings
Type: object
type
Type: string
It contains the mode of the payment method.
Cash On Delivery
_id
Type: string
Unique id of the payment method.
status   
Type: string
It shows the status of order at various stages.

The possible values of status are:
 
Open: This status indicates that the order is placed with any of the payment mode.
Closed: This status indicates that the order is completed.
Cancelled: This status indicates that the order has been cancelled by the user or admin.
shipping_method   
Type: object
The object contains the information of the shipping method used for placing the order.
{
  "shipping_method": {
    "name": "Shipping charges",
    "price": 0,
    "seller": "all_sellers",
    "prices_are": "exclusive",
    "taxes": [
      {
        "name": "CGST",
        "taxable_amount": 0,
        "tax_amount": 0,
        "tax_type": "exclusive",
        "rate": 2.5,
        "_id": "5a9e9a65bdac12b450321d63"
      },
      {
        "name": "SGST",
        "taxable_amount": 0,
        "tax_amount": 0,
        "tax_type": "exclusive",
        "rate": 2.5,
        "_id": "5a9e9a65bdac12b450321d64"
      }
    ],
    "taxes_total": "0.000",
    "tax_applied_on": "0.00",
    "tax_plus_taxable_amount": "0.00"
  }
}
_id
Type: string
This field contains the id of the shipping method.
name
Type: string
Name of the shipping method applied.
Shipping Charges
price
Type: number
The amount of shipping charges applied.
discounts_total
Type: number
discounts_percentage
Type: number
taxes   
Type: string
Array of taxes applicable on the order.
<pre class="language-json"><code>"taxes": [
        {
          "name": "CGST",
          "taxable_amount": 380,
          "tax_amount": "9.50",
          "tax_type": "exclusive",
          "index": 1,
          "rate": 2.5,
          "_id": "5a9e9a65bdac12b450321d63"
        },
        {
          "name": "SGST",
          "taxable_amount": 380,
          "tax_amount": "9.50",
          "tax_type": "exclusive",
          "index": 2,
          "rate": 2.5,
          "_id": "5a9e9a65bdac12b450321d64"
        }
      ]</code></pre>
discounts   
Type: string
It is an array of object containing details of cart level discounts.
<pre class="language-json"><code>"discounts":[{
        "_id":"53b256e9b3af14aa15e451a5",
        "saving_amount":100,
        "coupon_code":"Get 100"
}]</code></pre>
total   
Type: number
This field contain total amount payable/paid for order.
financial_status   
Type: string
This field show the status of payment at various stages. Possible values are :
Pending = This indicate that payment for order is still not pending.
Paid = This indicate that payment for order is made.
<p>pending</p>
fulfillment_status   
Type: string
cart_id   
Type: string
ID of the cart for which the order was generated.
sub_total   
Type: number
This field contain total summation of all item's total present in order.
discounts_total   
Type: number
Total discount value applied on the order.
currency   
Type: object
It is object containing name and conversion_rate of currency
<pre class="language-json"><code>"currency":{ "name":"USD", "conversion_rate":"0.14"}</code></pre>
name
Type: string
conversion_rate
Type: string
taxes_total   
Type: number
This field contain the total tax amount charged on cart.
shipping_total   
Type: number
This field contain the total shipping charges applied on order.
billing_address   
Type: object
The billing address associated with the payment method. This address is an optional field that will not be available on orders that do not require one.
{
  "address": "B4-309 Spaze iTech Park, Sector-49, Sohna Road",
  "city": "Gurgoan",
  "country": "IN",
  "full_name": "Testing",
  "phone": "1234567890",
  "state": "Harayana",
  "zip": "122001"
}
country
Type: string
The name of the country of the billing address.
full_name
Type: string
The full name of the person associated with the payment method.
address
Type: string
The street address of the billing address.
city
Type: string
The city of the billing address.
state
Type: string
The state of the billing address.
zip
Type: string
The zip or postal code of the billing address.
phone
Type: string
The phone number at the billing address.
shipping_address   
Type: object
This field holds address at which order is to be shipped.
<pre class="language-json"><code>"shipping_address":{
    "full_name": "sample address"
    "address": "Moti Nagar "
    "city": "Delhi"
    "state": "Delhi"
    "country": "IN"
    "zip": "110001"
    "phone": "555-625-1199"
}</code></pre>
country
Type: string
The name of the country of the shipping address.
full_name
Type: string
The full name of the person associated with the payment method.
city
Type: string
The city of the shipping address.
address
Type: string
The street address of the shipping address
state
Type: string
The state of the shipping address.
zip
Type: string
The zip or postal code of the shipping address.
phone
Type: string
The phone number at the billing address.
additional_charges   
Type: array
It is an array of object containing details of additional charges.
<pre class="language-json"><code>"additional_charges":[{
     "name":" Offline payment Changes",
     "type":"payment_charges",
     "price" :"50"
}]</code></pre>
name
Type: string
type
Type: string
amount
Type: number
_id
Type: string
item_count   
Type: string
This field contain the total  number of items in order.
email   
Type: string
This field contain email id of customer.
<p>trial@storehippo.com</p>
fulfillments   
Type: array
Details of shipment like tracking_number, logistics company, etc of a shipped order.
method
Type: string
price
Type: string
service
Type: string
status
Type: string
tracking_company
Type: string
tracking_number
Type: string
fulfillments_new   
Type: relation
shipments   
Type: relation
user_id   
Type: string
This field has the unique id of user placed the order.
transactions   
Type: relation
returns   
Type: relation
refunds   
Type: relation
client_details   
Type: object
This object contains the detail of system of the user. These details is gathered for navigator object of javascript.
{
  "client_details": {
         "platform": "Win", 
         "browser": "Chrome"
   }
}
appCodeName
Type: string
appName
Type: string
appVersion
Type: string
platform
Type: string
cookieEnabled
Type: string
languages
Type: array
device
Type: string
balance_amount   
Type: number
Amount to be received from the customer for the order.
txn_id   
Type: string
This field has unique identifier which is used for making payment.
seller   
Type: string
ID of the order's seller.
cancellation_reason   
Type: string
purchase_order_id   
Type: string
user_input   
Type: custom

Commands (Endpoints)

GET /api/1/entity/ms.orders/_/cancelOrder   
Cancel the order

Examples

Cancel Order

Request
{
orderId:"123456",
reason:"not intersted"
}
Response
{
status:200
}
GET /api/1/entity/ms.orders/{resource_id}   
Retrieves a single order

Examples

Delete single order

Request
{
    "entity":"ms.orders",
    "recordId":"53b256e9b3af14aa15e451a5"
}
Response
{
    "data":"Deleted Successfully"
}
GET /api/1/entity/ms.orders/_/markAsDelivered   

This command takes shipping status and id of the order to set its shipping_status anddelhiverystatus to "Delivered". 
If the financial status of the order is "Paid" it marks the status of the order as closed.

Examples

markAsDelivered

Request
{
"data": {
  "shipping_status": "Delivered",
  "order_delivered": "1"
 }
}
Response
GET /api/1/entity/ms.orders/_/markAsShipped   
This command takes awb number, name of logistics service and order details to create its shipment and send a mail notification to the customer

Examples

Mark an order as Shipped

Request
{
  "awb": "test12345",
  "details": {
    "_id": "57dbb73cd593ea345ddcc98d",
    "items": [
      {
        "_id": "57db7ce3e42b47a115e533f6",
        "name": "ppp",
        "product_id": "573d4b352e6910c3589bc34b",
        "metafields": {
          "location_based_prices": []
        },
        "weight": "10",
        "linked_product_id": null,
        "price": "100.00",
        "quantity": 2,
        "total": 100
      }
    ],
    "sub_total": 5100,
    "total": 5100,
    "item_count": "2",
    "email": "sumit.yadav@hippoinnovations.com",
    "shipping_address": {
      "country": "IN",
      "full_name": "yadav",
      "address": "Spaze I tech Park",
      "city": "gurgaon",
      "state": "Haryana",
      "zip": "122001",
      "phone": "9876543210"
    },
    "order_id": "OID806",
    "payment_status": "paid",
    "return": false
  },
  "service_used": "test service",
  "generate_shipping_label": true,
  "send_mail": false
}
Response
GET /api/1/entity/ms.orders/_/receivePayment   
This method is called when an order's cod amount is remitted. It marks the financial_status of the cod order as "Paid". If the tracking status of the order is "Delivered" it marks the status of the order as closed.

Also, adds an transaction record in ms.transactions