# Orders

&#x20;An order is a customer's completed request to purchase one or more products from a shop. An order is created when a customer completes the checkout process, during which time they provide an email address or phone number, billing address and payment information.

{% hint style="info" %}
It is good to have per item 1 quantity, for per item multi quantity calculation will be different.
{% endhint %}

{% tabs %}
{% tab title="Attributes" %}

| Attributes                     | Type            | Description                                                                                                             |
| ------------------------------ | --------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `id`                           | `integer`       | Unique identification id for create order                                                                               |
| `externalChannelID`            | `string`        | Sales Channel Name of client                                                                                            |
| `customerOrderNumber`          | `string`        | Unique Number against Each Sales Channel                                                                                |
| `vendorOrderNumber`            | `string`        | unique number provide by merchant itself                                                                                |
| `orderDate`                    | `string`        | order created Date Time e.g: 2020-03-12 00:00:00                                                                        |
| `expectedShipDate`             | `string`        | expected date on which order should be shipped from facility e.g: 2020-03-13 00:00:00                                   |
| `promiseDeliveryDate`          | `string`        | Delivery date on which order should be delivered e.g: 2020-03-18 00:00:00                                               |
| `isCOD`                        | `string`        | Type of order `Enum : 0 , 1`(1 if order is cod,0 if order is prepaid)                                                   |
| `paymentType`                  | `string`        | Payment Method of order                                                                                                 |
| `taxAmount`                    | `number`        | tax amount of order                                                                                                     |
| `shipChargeAmount`             | `number`        | Total shipping charge on order                                                                                          |
| `subtotal`                     | `number`        | total sum of all item price                                                                                             |
| `orderTotal`                   | `number`        | invoice total of order                                                                                                  |
| `balanceDue`                   | `number`        | amount that customer has to pay                                                                                         |
| `thirdPartyShipping`           | `boolean`       | true,false (False : if courier will be assigned by Eshopbox , true : if courier will be assigned by vendor itself)      |
| `onHold`                       | `boolean`       | true,false (true : in this case there will be no operations happens on order, false: all the operations will be happen) |
| `shippingAddress`              | `object`        | shipping address object                                                                                                 |
| `shippingAddress.customerName` | `string`        | shippingAddress customer Name                                                                                           |
| `shippingAddress.addressLine1` | `string`        | shipping address line first                                                                                             |
| `shippingAddress.addressLine2` | `string`        | shipping address line second                                                                                            |
| `shippingAddress.city`         | `string`        | shipping city                                                                                                           |
| `shippingAddress.state`        | `string`        | shipping state                                                                                                          |
| `shippingAddress.postalCode`   | `string`        | shipping postal code                                                                                                    |
| `shippingAddress.countryCode`  | `string`        | shipping country code                                                                                                   |
| `shippingAddress.countryName`  | `string`        | shipping country name                                                                                                   |
| `shippingAddress.contactPhone` | `string`        | shipping address contact number                                                                                         |
| `shippingAddress.email`        | `string`        | shipping address email ID                                                                                               |
| `billingAddress`               | `object`        | billing address object                                                                                                  |
| `billingAddress.customerName`  | `string`        | billing name of customer                                                                                                |
| `billingAddress.addressLine1`  | `string`        | billing address line first                                                                                              |
| `billingAddress.addressLine2`  | `string`        | billing address line second                                                                                             |
| `billingAddress.city`          | `string`        | billing city                                                                                                            |
| `billingAddress.state`         | `string`        | billing state                                                                                                           |
| `billingAddress.postalCode`    | `string`        | billing postal code                                                                                                     |
| `billingAddress.countryCode`   | `string`        | billing country code                                                                                                    |
| `billingAddress.countryName`   | `string`        | billing country name                                                                                                    |
| `billingAddress.contactPhone`  | `string`        | billing person contact number                                                                                           |
| `billingAddress.email`         | `string`        | billing person email ID                                                                                                 |
| `items`                        | `array[object]` | The order items object                                                                                                  |
| `created_at`                   | `string`        | created timestamp of order e.g: "2020-03-12 00:00:00"                                                                   |
| `updated_at`                   | `string`        | updated timestamp of order e.g: "2020-03-12 00:00:00"                                                                   |
| {% endtab %}                   |                 |                                                                                                                         |

{% tab title="Sample Json" %}

```php
{
    "id": 1497564,
    "externalChannelID": "TATA CLIQ VELOCY KAPAS KRAFT",
    "customerOrderNumber": "300226582",
    "vendorOrderNumber": "",
    "shipMethod": "STD",
    "orderDate": "2020-02-29 15:39:11",
    "expectedShipDate": "2020-03-02 15:00:00",
    "promiseDeliveryDate": "0000-00-00 00:00:00",
    "isCOD": "0",
    "paymentType": "DebitCard",
    "taxAmount": 0,
    "shipChargeAmount": 0,
    "subtotal": 4049.09,
    "orderTotal": 4049.09,
    "balanceDue": 0,
    "thirdPartyShipping": true,
    "onHold": false,
    "created_at": "2020-02-24 15:48:27",
    "updated_at": "2020-03-01 13:01:10",
    "shippingAddress": {
       "customerName": "John Doe",
        "addressLine1": "Kapas Kraft Apparels Limited",
        "addressLine2": "Banglore",
        "city": "bengluru",
        "state": "Karnataka",
        "postalCode": "560005",
        "countryCode": "IN",
        "countryName": "India",
        "contactPhone": "9998889998",
        "email": "johndoe@gmail.com"
    },
    "billingAddress": {
        "customerName": "John Doe",
        "addressLine1": "Kapas Kraft Apparels Limited",
        "addressLine2": "Banglore",
        "city": "bengluru",
        "state": "Karnataka",
        "postalCode": "560005",
        "countryCode": "IN",
        "countryName": "India",
        "contactPhone": "9998889998",
        "email": "johndoe@gmail.com"
    },
    "items": [
        {
            "lineItemSequenceNumber": 112988,
            "orderItemID": "11920832654052201",
            "itemID": "DB9U03FMGWZ",
            "sku": "1234_S",
            "productName": "Pace Barnes",
            "quantity": 1,
            "customerPrice": 4499,
            "discount": 449.89,
            "lineItemTotal": 4049.09,
            "taxRate": 0,
            "taxAmount": 0,
            "returnPolicyCode": "",
            "cancellationPolicyCode": "",
            "productAdditionalInfo": {
                "size": "",
                "color": ""
            },
            "productUrl":"https://montecarlo.auperator.co/product/edit-product/BBAPLMC144105_44 ",
            "productImageUrl": "https://s3-eu-west-1.amazonaws.com/imagebucketeshopbox/Uzip/219045371-1-40/1.JPG"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

&#x20;**The `Items` Object**

| Attributes                       | Type      | Description                                                                                                                                 |
| -------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `items[].lineItemSequenceNumber` | `integer` | incremental id of each item in a order                                                                                                      |
| `items[].orderItemID`            | `string`  | unique generated id by eshopbox                                                                                                             |
| `items[].itemID`                 | `string`  | variant id of item (seller SKU code which marked available on created products on a sales channel in eshopbox)                              |
| `items[].sellerSkuOnChannel`     | string    | seller Sku (This is only required if there is no product created in eshopbox for a sales channel, Eshopbox will create the product by self) |
| `items[].sku`                    | `string`  | Eshopbox Esin of item                                                                                                                       |
| `items[].productName`            | `string`  | name of the item                                                                                                                            |
| `items[].quantity`               | `integer` | quantity of the item                                                                                                                        |
| `items[].customerPrice`          | `number`  | unit price of item                                                                                                                          |
| `items[].discount`               | `number`  | discount on item                                                                                                                            |
| `items[].lineItemTotal`          | `number`  | total price of item                                                                                                                         |
| `items[].taxRate`                | `number`  | tax rate on item                                                                                                                            |
| `items[].taxAmount`              | `number`  | tax amount on item                                                                                                                          |
| items\[].mrp                     | number    | MRP of the item                                                                                                                             |
| `items[].cancellationPolicyCode` | `string`  | cancellation policy on item defined by client                                                                                               |
| `items[].returnPolicyCode`       | `string`  | returnPolicyCode on item defined by client                                                                                                  |
| `items[].productAdditionalInfo`  | `object`  | additional info of item                                                                                                                     |
| `items[].productUrl`             | `string`  | product url of item                                                                                                                         |
| `items[].productImageUrl`        | `string`  | product image url of item                                                                                                                   |

The **`productAdditionInfo`** Object

| Attribute                      | Type     | Description                                 |
| ------------------------------ | -------- | ------------------------------------------- |
| `productAdditionalInfo.size`   | `string` | Size of the item                            |
| `productAdditionalInfo.color`  | `string` | Color of the item                           |
| `productAdditionalInfo.length` | number   | Additional details used to create a product |
| `productAdditionalInfo.width`  | number   | Additional details used to create a product |
| `productAdditionalInfo.height` | number   | Additional details used to create a product |
| `productAdditionalInfo.weight` | number   | Additional details used to create a product |

### Enum: isCOD

| Attribute | Description                   |
| --------- | ----------------------------- |
| 0         | created order must be Prepaid |
| 1         | created order must be COD     |

|   |
| - |
