> For the complete documentation index, see [llms.txt](https://eshop.gitbook.io/eshopbox-developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eshop.gitbook.io/eshopbox-developers/order/orders/how-invoicing-works.md).

# How invoicing works

There can be different invoicing cases(discounts, additional charges) on an order. This guide outlines different invoicing cases on an order.

## **Before we start**

This guide assumes that you're familiar with creating an [Order](https://app.gitbook.com/@eshop/s/api-reference/order/orders).

## **Step by step guide**

### Cart Discount

It is implemented on the whole order, the total discount is divided equally on each item. Refer to the below table while creating an order request.

| **Attribute** | **Field**           | **Value**                                                                 |
| ------------- | ------------------- | ------------------------------------------------------------------------- |
| Order         | subtotal            | sum of all lineItemTotal of an order                                      |
| Order         | orderTotal          | subtotal + shipping charges                                               |
| Order         | balanceDue          | If order is COD, balanceDue = orderTotal                                  |
| Items         | items.discount      | Discount(in case of multiple items discount = total Discount/No of items) |
| Items         | items.customerPrice | Selling Price\[Inclusive of taxes]                                        |
| Items         | items.lineItemTotal | (Selling Price- Discount)\*Quantity                                       |

Sample request when cart discount is applied on an order:

```
{
 "id": 1842937,
 "externalChannelID": "TATA CLIQ VELOCY KAPAS KRAFT",
 "customerOrderNumber": "OD119208447831346000",
 "vendorOrderNumber": "11920832654052201",
 "shipMethod": "STD",
 "orderDate": "2020-07-09 17:51:05",
 "expectedShipDate": "2020-07-10 15:00:00",
 "promiseDeliveryDate": "0000-00-00 00:00:00",
 "isCOD": "0",
 "paymentType": "DebitCard",
 "taxAmount": 0,
 "shipChargeAmount": 150,
 "subtotal": 1499,
 "orderTotal": 1649,
 "balanceDue": 0,
 "thirdPartyShipping": true,
 "onHold": false,
 "created_at": "2020-07-09 18:03:29",
 "updated_at": "2020-07-09 18:03:29",
 "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": 123279,
 "orderItemID": "11920832654052201",
 "itemID": "DB9U03FMGWZ",
 "sku": "1234_S",
 "productName": "Step Maro Sol",
 "quantity": 1,
 "customerPrice": 1999,
 "discount": 500,
 "lineItemTotal": 1499,
 "taxRate": 0,
 "taxAmount": 0,
 "giftMessage": "",
 "giftLabelContent": "",
 "cancellationReason": "",
 "cancellationTime": "0000-00-00 00:00:00",
 "original_order_item_id": null
 }
 ],
 "expectedDeliveryDate": null
}
```

### Shipping Fees

The shipping fee is the cost used to ship items to a buyer. Refer to the below table while creating an order request.

| **Attribute** | **Field**        | **Value**                            |
| ------------- | ---------------- | ------------------------------------ |
| Order         | shipChargeAmount | shipping charges on the order level  |
| Order         | subtotal         | sum of all lineItemTotal of an order |
| Order         | orderTotal       | subtotal + shipping charges          |

Sample request when shipping fee is added to an order:

```
{
 "id": 1842996,
 "externalChannelID": "TATA CLIQ VELOCY KAPAS KRAFT",
 "customerOrderNumber": "OD119208447831346000",
 "vendorOrderNumber": "11920832654052201",
 "shipMethod": "STD",
 "orderDate": "2020-07-09 18:08:10",
 "expectedShipDate": "2020-07-10 15:00:00",
 "promiseDeliveryDate": "0000-00-00 00:00:00",
 "isCOD": "1",
 "paymentType": "CashOnDelivery",
 "taxAmount": 0,
 "shipChargeAmount": 150,
 "subtotal": 2399,
 "orderTotal": 2549,
 "balanceDue": 2549,
 "thirdPartyShipping": true,
 "onHold": false,
 "created_at": "2020-07-09 18:13:32",
 "updated_at": "2020-07-09 18:13:32",
 "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": 123282,
 "orderItemID": "11920832654052201",
 "itemID": "DB9U03FMGWZ",
 "sku": "1234_S",
 "productName": "Reazor Edge",
 "quantity": 1,
 "customerPrice": 2399,
 "discount": 0,
 "lineItemTotal": 2399,
 "taxRate": 0,
 "taxAmount": 0,
 "giftMessage": "",
 "giftLabelContent": "",
 "cancellationReason": "",
 "cancellationTime": "0000-00-00 00:00:00",
 "original_order_item_id": null
 }
 ],
 "expectedDeliveryDate": null
}
```
