# Finance

## Get Incomes

<mark style="color:blue;">`GET`</mark> `https://api.zortout.com/api.aspx`

Get list of incomes.

#### Query Parameters

| Name                                      | Type   | Description                                                |
| ----------------------------------------- | ------ | ---------------------------------------------------------- |
| method<mark style="color:red;">\*</mark>  | String | "GETINCOMES"                                               |
| createdatetimeafter                       | String | <p>Created Datetime After .....<br>(yyyy-MM-dd HH:mm)</p>  |
| paymentbefore                             | String | <p>Paid Date Before .....<br>(yyyy-MM-dd)</p>              |
| paymentafter                              | String | <p>Paid Date After .....<br>(yyyy-MM-dd)</p>               |
| updatedbefore                             | String | <p>Updated Date Before .....<br>(yyyy-MM-dd)</p>           |
| updatedafter                              | String | <p>Updated Date After .....<br>(yyyy-MM-dd)</p>            |
| createdbefore                             | String | <p>Created Date Before .....<br>(yyyy-MM-dd)</p>           |
| createdafter                              | String | <p>Created Date After .....<br>(yyyy-MM-dd)</p>            |
| incomedatebefore                          | String | <p>Income Date Before .....<br>(yyyy-MM-dd)</p>            |
| incomedateafter                           | String | <p>Income Date After .....<br>(yyyy-MM-dd)</p>             |
| version<mark style="color:red;">\*</mark> | String | 3                                                          |
| format                                    | String | json (Default), xml                                        |
| limit                                     | Int    | Limit per page (Max = 2000)                                |
| page                                      | Int    | Page (Default = 1)                                         |
| keyword                                   | String | Keyword to search                                          |
| updatedatetimebefore                      | String | <p>Updated Datetime Before .....<br>(yyyy-MM-dd HH:mm)</p> |
| updatedatetimeafter                       | String | <p>Updated Datetime After .....<br>(yyyy-MM-dd HH:mm)</p>  |
| createdatetimebefore                      | String | <p>Created Datetime Before .....<br>(yyyy-MM-dd HH:mm)</p> |

#### Headers

| Name                                        | Type   | Description                                    |
| ------------------------------------------- | ------ | ---------------------------------------------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name                                     |
| apikey<mark style="color:red;">\*</mark>    | String | API Key                                        |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret                                     |
| incomeidlist                                | String | <p>List Of Income ID <br>Ex. “123,124,125”</p> |

{% tabs %}
{% tab title="200: OK Success" %}
{% tabs %}
{% tab title="Response" %}

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

| Payment (Array)       | Type     | Description/Example                                 |
| --------------------- | -------- | --------------------------------------------------- |
| id                    | Int      | Payment ID                                          |
| name                  | String   | Payment Method Name                                 |
| amount                | Double   | Payment Amount                                      |
| paymentdatetime       | Datetime | Payment Datetime                                    |
| paymentdatetimeString | String   | <p>Payment Datetime Text <br>(yyyy-MM-dd HH:mm)</p> |

| IncomeItem (Array) | Type   | Description/Example |
| ------------------ | ------ | ------------------- |
| id                 | Int    | Item ID             |
| name               | String | Item Name           |
| categoryname       | String | Item Category       |
| totalprice         | Double | Total Price         |

| IncomeTransaction (Array) | Type               | Description/Example                                                             |
| ------------------------- | ------------------ | ------------------------------------------------------------------------------- |
| id                        | Int                | Income ID                                                                       |
| contactid                 | Int                | Contact ID                                                                      |
| contactname               | String             | Contact Name                                                                    |
| contactidnumber           | String             | Contact ID Number/Tax ID                                                        |
| contactemail              | String             | Contact Email                                                                   |
| contactphone              | String             | Contact Phone                                                                   |
| contactaddress            | String             | Contact Address                                                                 |
| contactbranchname         | String             | Contact Branch Name                                                             |
| contactbranchno           | String             | Contact Branch No                                                               |
| paymentstatus             | String             | Payment Status (Pending, Paid, Partial Payment, Excess Payment)                 |
| amount                    | Double             | Net Amount                                                                      |
| vatamount                 | Double             | Vat Amount                                                                      |
| incomedate                | Date               | <p>Income Date<br>(yyyy-MM-dd)</p>                                              |
| incomedateString          | String             | Income Date Text (yyyy-MM-dd)                                                   |
| paymentamount             | Double             | Payment Amount                                                                  |
| reference                 | String             | Reference                                                                       |
| description               | String             | Description                                                                     |
| discount                  | String             | <p>Discount<br>Ex.5.00, 10%</p>                                                 |
| vattype                   | Int                | <p>Vat Type <br>1 – No Vat (Default) <br>2 – Exclude Vat<br>3 – Include Vat</p> |
| list                      | IncomeItem (Array) | Item List                                                                       |
| payments                  | Payment (Array)    | Payment List                                                                    |
| tag                       | String (Array)     | Tag List (Array)                                                                |
| createdatetime            | Datetime           | Created Datetime                                                                |
| createdatetimeString      | String             | <p>Created Datetime Text <br>(yyyy-MM-dd HH:mm)</p>                             |
| updatedatetime            | Datetime           | Updated Datetime                                                                |
| updatedatetimeString      | String             | <p>Updated Datetime Text<br>(yyyy-MM-dd HH:mm)</p>                              |
| createuserid              | Int                | Created User ID                                                                 |
| createusername            | String             | Created User (Username)                                                         |
| createdby                 | String             | Created User (Display name)                                                     |
| uniquenumber              | String             | Unique Number                                                                   |

| Parameter | Type                      | Description/Example                   |
| --------- | ------------------------- | ------------------------------------- |
| res       | Response                  | <p>Response Code <br>200- Success</p> |
| list      | IncomeTransaction (Array) | Income Transaction List (Array)       |
| count     | Int                       | Total income number by filter         |

## Get Income Detail

<mark style="color:blue;">`GET`</mark> `https://api.zortout.com/api.aspx`

Get income detail.

#### Query Parameters

| Name                                      | Type   | Description         |
| ----------------------------------------- | ------ | ------------------- |
| method<mark style="color:red;">\*</mark>  | String | "GETINCOMEDETAIL"   |
| format                                    | String | json (Default), xml |
| version<mark style="color:red;">\*</mark> | String | 3                   |
| id<mark style="color:red;">\*</mark>      | Int    | Income ID           |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

{% tabs %}
{% tab title="200: OK Success" %}
{% tabs %}
{% tab title="Response" %}

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

| Payment (Array)       | Type     | Description/Example                                 |
| --------------------- | -------- | --------------------------------------------------- |
| id                    | Int      | Payment ID                                          |
| name                  | String   | Payment Method Name                                 |
| amount                | Double   | Payment Amount                                      |
| paymentdatetime       | Datetime | Payment Datetime                                    |
| paymentdatetimeString | String   | <p>Payment Datetime Text <br>(yyyy-MM-dd HH:mm)</p> |

| IncomeItem (Array) | Type   | Description/Example |
| ------------------ | ------ | ------------------- |
| id                 | Int    | Item ID             |
| name               | String | Item Name           |
| categoryname       | String | Item Category       |
| totalprice         | Double | Total Price         |

| Parameter            | Type               | Description/Example                                                             |
| -------------------- | ------------------ | ------------------------------------------------------------------------------- |
| id                   | Int                | Income ID                                                                       |
| contactid            | Int                | Contact ID                                                                      |
| contactname          | String             | Contact Name                                                                    |
| contactidnumber      | String             | Contact ID Number/Tax ID                                                        |
| contactemail         | String             | Contact Email                                                                   |
| contactphone         | String             | Contact Phone                                                                   |
| contactaddress       | String             | Contact Address                                                                 |
| contactbranchname    | String             | Contact Branch Name                                                             |
| contactbranchno      | String             | Contact Branch No                                                               |
| paymentstatus        | String             | Payment Status (Pending, Paid, Partial Payment, Excess Payment)                 |
| amount               | Double             | Net Amount                                                                      |
| vatamount            | Double             | Vat Amount                                                                      |
| incomedate           | Date               | <p>Income Date<br>(yyyy-MM-dd)</p>                                              |
| incomedateString     | String             | Income Date Text (yyyy-MM-dd)                                                   |
| paymentamount        | Double             | Payment Amount                                                                  |
| reference            | String             | Reference                                                                       |
| description          | String             | Description                                                                     |
| discount             | String             | <p>Discount<br>Ex.5.00, 10%</p>                                                 |
| vattype              | Int                | <p>Vat Type <br>1 – No Vat (Default) <br>2 – Exclude Vat<br>3 – Include Vat</p> |
| list                 | IncomeItem (Array) | Item List                                                                       |
| payments             | Payment (Array)    | Payment List                                                                    |
| tag                  | String (Array)     | Tag List (Array)                                                                |
| createdatetime       | Datetime           | Created Datetime                                                                |
| createdatetimeString | String             | <p>Created Datetime Text <br>(yyyy-MM-dd HH:mm)</p>                             |
| updatedatetime       | Datetime           | Updated Datetime                                                                |
| updatedatetimeString | String             | <p>Updated Datetime Text<br>(yyyy-MM-dd HH:mm)</p>                              |
| createuserid         | Int                | Created User ID                                                                 |
| createusername       | String             | Created User (Username)                                                         |
| createdby            | String             | Created User (Display name)                                                     |
| uniquenumber         | String             | Unique Number                                                                   |

## Add Income

<mark style="color:green;">`POST`</mark> `https://api.zortout.com/api.aspx`

Add income.

#### Query Parameters

| Name                                      | Type   | Description                                                                                 |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------------------- |
| method<mark style="color:red;">\*</mark>  | String | "ADDINCOME"                                                                                 |
| format                                    | String | json (Default), xml                                                                         |
| version<mark style="color:red;">\*</mark> | String | 3                                                                                           |
| uniquenumber                              | String | <p>Unique Number.</p><p>This value is unique and used to prevent duplicate transaction.</p> |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

#### Request Body

| Name                                           | Type               | Description                                                                                                                                                                                                                                                                      |
| ---------------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contactname                                    | String             | Contact Name                                                                                                                                                                                                                                                                     |
| contactidnumber                                | String             | Contact ID Number/Tax ID                                                                                                                                                                                                                                                         |
| contactemail                                   | String             | Contact Email                                                                                                                                                                                                                                                                    |
| contactphone                                   | String             | Contact Phone                                                                                                                                                                                                                                                                    |
| contactaddress                                 | String             | Contact Address                                                                                                                                                                                                                                                                  |
| contactbranchname                              | String             | Contact Branch Name                                                                                                                                                                                                                                                              |
| amount<mark style="color:red;">\*</mark>       | Double             | Net Amount                                                                                                                                                                                                                                                                       |
| customerbranchno                               | String             | Contact Branch No                                                                                                                                                                                                                                                                |
| vatamount                                      | Double             | Vat Amount                                                                                                                                                                                                                                                                       |
| vattype                                        | Int                | <p>Vat Type <br>1 – No Vat<br>2 – Exclude Vat<br>3 – Include Vat<br>If vattype is not defined, the system will use vatamount to calculate and define automatically.<br>If vattype = 1, 2 or 3, the system will ignore vatamount and calculate vatamount value automatically.</p> |
| incomedate                                     | String             | <p>Income Date<br>Ex. "2021-09-15"</p>                                                                                                                                                                                                                                           |
| paymentmethod                                  | String             | Payment Method                                                                                                                                                                                                                                                                   |
| paymentamount                                  | Double             | <p>Payment Amount</p><p>("paymentmethod" must be required.)</p>                                                                                                                                                                                                                  |
| paymentdate                                    | String             | <p>Payment Datetime <br>Ex. “2021-09-15 21:05”</p>                                                                                                                                                                                                                               |
| description                                    | String             | Description                                                                                                                                                                                                                                                                      |
| discount                                       | String             | <p>Discount <br>Ex. 5.00, 10%</p>                                                                                                                                                                                                                                                |
| tag                                            | String (Array)     | Tag List (Array)                                                                                                                                                                                                                                                                 |
| list                                           | IncomeItem (Array) | Item List                                                                                                                                                                                                                                                                        |
| ∟ name<mark style="color:red;">\*</mark>       | String             | Item Name                                                                                                                                                                                                                                                                        |
| ∟ categoryname                                 | String             | Item Category                                                                                                                                                                                                                                                                    |
| ∟ totalprice<mark style="color:red;">\*</mark> | Double             | Total Price                                                                                                                                                                                                                                                                      |
| reference                                      | String             | Reference                                                                                                                                                                                                                                                                        |

{% tabs %}
{% tab title="200: OK Success" %}
{% tabs %}
{% tab title="Response" %}

{% endtab %}

{% tab title="Ex. URL" %}
URL : <https://api.zortout.com/api.aspx?method=ADDINCOME&version=3>
{% endtab %}

{% tab title="Ex. Request JSON" %}

```
{
  "incomedate": "2021-05-31",
  "amount": 58,
  "vatamount": 0,
  "paymentmethod": "Cash",
  "list": [
    {
      "name": "Income1",
      "categoryname": "Others",
      "totalprice": 48
    },
    {
      "name": "Income2",
      "totalprice": 10
    }
  ]
}
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

| Parameter | Type   | Description/Example                   |
| --------- | ------ | ------------------------------------- |
| resCode   | String | <p>Response Code <br>200- Success</p> |
| resDesc   | String | Response Description                  |

## Update Income Payment

<mark style="color:green;">`POST`</mark> `https://api.zortout.com/api.aspx`

Update payment of income.

#### Query Parameters

| Name                                            | Type   | Description                                        |
| ----------------------------------------------- | ------ | -------------------------------------------------- |
| method<mark style="color:red;">\*</mark>        | String | “UPDATEINCOMEPAYMENT”                              |
| paymentdate                                     | String | <p>Payment Datetime <br>Ex. “2021-09-15 21:05”</p> |
| paymentamount<mark style="color:red;">\*</mark> | Double | Payment Amount                                     |
| paymentmethod<mark style="color:red;">\*</mark> | String | Payment Method                                     |
| version<mark style="color:red;">\*</mark>       | String | 3                                                  |
| format                                          | String | json (Default), xml                                |
| id<mark style="color:red;">\*</mark>            | Int    | Income ID                                          |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

{% tabs %}
{% tab title="200: OK Success" %}
{% tabs %}
{% tab title="Response" %}

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

| Parameter | Type   | Description/Example                   |
| --------- | ------ | ------------------------------------- |
| resCode   | String | <p>Response Code <br>200- Success</p> |
| resDesc   | String | Response Description                  |

## Get Expenses

<mark style="color:blue;">`GET`</mark> `https://api.zortout.com/api.aspx`

Get list of expenses.

#### Path Parameters

| Name   | Type   | Description         |
| ------ | ------ | ------------------- |
| format | String | json (Default), xml |

#### Query Parameters

| Name                                      | Type   | Description                                                |
| ----------------------------------------- | ------ | ---------------------------------------------------------- |
| method<mark style="color:red;">\*</mark>  | String | "GETEXPENSES"                                              |
| expensedatebefore                         | String | <p>Expense Date Before .....<br>(yyyy-MM-dd)</p>           |
| expensedateafter                          | String | <p>Expense Date After .....<br>(yyyy-MM-dd)</p>            |
| version<mark style="color:red;">\*</mark> | String | 3                                                          |
| format                                    | String | json (Default), xml                                        |
| updatedbefore                             | String | <p>Updated Date Before .....<br>(yyyy-MM-dd)</p>           |
| updatedafter                              | String | <p>Updated Date After .....<br>(yyyy-MM-dd)</p>            |
| createdbefore                             | String | <p>Created Date Before .....<br>(yyyy-MM-dd)</p>           |
| createdafter                              | String | <p>Created Date After .....<br>(yyyy-MM-dd)</p>            |
| createdatetimeafter                       | String | <p>Created Datetime After .....<br>(yyyy-MM-dd HH:mm)</p>  |
| paymentbefore                             | String | <p>Paid Date Before .....<br>(yyyy-MM-dd)</p>              |
| paymentafter                              | String | <p>Paid Date After .....<br>(yyyy-MM-dd)</p>               |
| updatedatetimebefore                      | String | <p>Updated Datetime Before .....<br>(yyyy-MM-dd HH:mm)</p> |
| updatedatetimeafter                       | String | <p>Updated Datetime After .....<br>(yyyy-MM-dd HH:mm)</p>  |
| createdatetimebefore                      | String | <p>Created Datetime Before .....<br>(yyyy-MM-dd HH:mm)</p> |
| limit                                     | Int    | Limit per page (Max = 2000)                                |
| page                                      | Int    | Page (Default = 1)                                         |
| keyword                                   | String | Keyword to search                                          |

#### Headers

| Name                                        | Type   | Description                                     |
| ------------------------------------------- | ------ | ----------------------------------------------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name                                      |
| apikey<mark style="color:red;">\*</mark>    | String | API Key                                         |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret                                      |
| expenseidlist                               | String | <p>List Of Expense ID <br>Ex. “123,124,125”</p> |

{% tabs %}
{% tab title="200: OK Success" %}
{% tabs %}
{% tab title="Response" %}

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

| Payment (Array)       | Type     | Description/Example                                 |
| --------------------- | -------- | --------------------------------------------------- |
| id                    | Int      | Payment ID                                          |
| name                  | String   | Payment Method Name                                 |
| amount                | Double   | Payment Amount                                      |
| paymentdatetime       | Datetime | Payment Datetime                                    |
| paymentdatetimeString | String   | <p>Payment Datetime Text <br>(yyyy-MM-dd HH:mm)</p> |

| ExpenseItem (Array) | Type   | Description/Example |
| ------------------- | ------ | ------------------- |
| id                  | Int    | Item ID             |
| name                | String | Item Name           |
| categoryname        | String | Item Category       |
| totalprice          | Double | Total Price         |

| ExpenseTransaction (Array) | Type                | Description/Example                                                             |
| -------------------------- | ------------------- | ------------------------------------------------------------------------------- |
| id                         | Int                 | Expense ID                                                                      |
| contactid                  | Int                 | Contact ID                                                                      |
| contactname                | String              | Contact Name                                                                    |
| contactidnumber            | String              | Contact ID Number/Tax ID                                                        |
| contactemail               | String              | Contact Email                                                                   |
| contactphone               | String              | Contact Phone                                                                   |
| contactaddress             | String              | Contact Address                                                                 |
| contactbranchname          | String              | Contact Branch Name                                                             |
| contactbranchno            | String              | Contact Branch No                                                               |
| paymentstatus              | String              | Payment Status (Pending, Paid, Partial Payment, Excess Payment)                 |
| amount                     | Double              | Net Amount                                                                      |
| vatamount                  | Double              | Vat Amount                                                                      |
| expensedate                | Date                | <p>Expense Date<br>(yyyy-MM-dd)</p>                                             |
| expensedateString          | String              | Expense Date Text (yyyy-MM-dd)                                                  |
| paymentamount              | Double              | Payment Amount                                                                  |
| reference                  | String              | Reference                                                                       |
| description                | String              | Description                                                                     |
| discount                   | String              | <p>Discount<br>Ex.5.00, 10%</p>                                                 |
| vattype                    | Int                 | <p>Vat Type <br>1 – No Vat (Default) <br>2 – Exclude Vat<br>3 – Include Vat</p> |
| list                       | ExpenseItem (Array) | Item List                                                                       |
| payments                   | Payment (Array)     | Payment List                                                                    |
| tag                        | String (Array)      | Tag List (Array)                                                                |
| createdatetime             | Datetime            | Created Datetime                                                                |
| createdatetimeString       | String              | <p>Created Datetime Text <br>(yyyy-MM-dd HH:mm)</p>                             |
| updatedatetime             | Datetime            | Updated Datetime                                                                |
| updatedatetimeString       | String              | <p>Updated Datetime Text<br>(yyyy-MM-dd HH:mm)</p>                              |
| createuserid               | Int                 | Created User ID                                                                 |
| createusername             | String              | Created User (Username)                                                         |
| createdby                  | String              | Created User (Display name)                                                     |
| uniquenumber               | String              | Unique Number                                                                   |

| Parameter | Type                       | Description/Example                   |
| --------- | -------------------------- | ------------------------------------- |
| res       | Response                   | <p>Response Code <br>200- Success</p> |
| list      | ExpenseTransaction (Array) | Expense Transaction List (Array)      |
| count     | Int                        | Total expense number by filter        |

## Get Expense Detail

<mark style="color:blue;">`GET`</mark> `https://api.zortout.com/api.aspx`

Get expense detail.

#### Query Parameters

| Name                                      | Type   | Description         |
| ----------------------------------------- | ------ | ------------------- |
| method<mark style="color:red;">\*</mark>  | String | "GETEXPENSEDETAIL"  |
| id<mark style="color:red;">\*</mark>      | Int    | Expense ID          |
| version<mark style="color:red;">\*</mark> | String | 3                   |
| format                                    | String | json (Default), xml |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

{% tabs %}
{% tab title="200: OK Success" %}
{% tabs %}
{% tab title="Response" %}

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

| Payment (Array)       | Type     | Description/Example                                 |
| --------------------- | -------- | --------------------------------------------------- |
| id                    | Int      | Payment ID                                          |
| name                  | String   | Payment Method Name                                 |
| amount                | Double   | Payment Amount                                      |
| paymentdatetime       | Datetime | Payment Datetime                                    |
| paymentdatetimeString | String   | <p>Payment Datetime Text <br>(yyyy-MM-dd HH:mm)</p> |

| ExpenseItem (Array) | Type   | Description/Example |
| ------------------- | ------ | ------------------- |
| id                  | Int    | Item ID             |
| name                | String | Item Name           |
| categoryname        | String | Item Category       |
| totalprice          | Double | Total Price         |

| Parameter            | Type                | Description/Example                                                             |
| -------------------- | ------------------- | ------------------------------------------------------------------------------- |
| id                   | Int                 | Expense ID                                                                      |
| contactid            | Int                 | Contact ID                                                                      |
| contactname          | String              | Contact Name                                                                    |
| contactidnumber      | String              | Contact ID Number/Tax ID                                                        |
| contactemail         | String              | Contact Email                                                                   |
| contactphone         | String              | Contact Phone                                                                   |
| contactaddress       | String              | Contact Address                                                                 |
| contactbranchname    | String              | Contact Branch Name                                                             |
| contactbranchno      | String              | Contact Branch No                                                               |
| paymentstatus        | String              | Payment Status (Pending, Paid, Partial Payment, Excess Payment)                 |
| amount               | Double              | Net Amount                                                                      |
| vatamount            | Double              | Vat Amount                                                                      |
| expensedate          | Date                | Expense Date                                                                    |
| expensedateString    | String              | Expense Date Text (yyyy-MM-dd)                                                  |
| paymentamount        | Double              | Payment Amount                                                                  |
| reference            | String              | Reference                                                                       |
| description          | String              | Description                                                                     |
| discount             | String              | <p>Discount <br>Ex.5.00, 10%</p>                                                |
| vattype              | Int                 | <p>Vat Type <br>1 – No Vat (Default) <br>2 – Exclude Vat<br>3 – Include Vat</p> |
| list                 | ExpenseItem (Array) | Item List                                                                       |
| payments             | Payment (Array)     | Payment List                                                                    |
| tag                  | String (Array)      | Tag List (Array)                                                                |
| createdatetime       | Datetime            | Created Datetime                                                                |
| createdatetimeString | String              | <p>Created Datetime Text <br>(yyyy-MM-dd HH:mm)</p>                             |
| updatedatetime       | Datetime            | Updated Datetime                                                                |
| updatedatetimeString | String              | <p>Updated Datetime Text<br>(yyyy-MM-dd HH:mm)</p>                              |
| createuserid         | Int                 | Created User ID                                                                 |
| createusername       | String              | Created User (Username)                                                         |
| createdby            | String              | Created User (Display name)                                                     |
| uniquenumber         | String              | Unique Number                                                                   |

## Add Expense

<mark style="color:green;">`POST`</mark> `https://api.zortout.com/api.aspx`

Add expense.

#### Query Parameters

| Name                                      | Type   | Description                                                                                 |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------------------- |
| method<mark style="color:red;">\*</mark>  | String | "ADDEXPENSE"                                                                                |
| uniquenumber                              | String | <p>Unique Number.</p><p>This value is unique and used to prevent duplicate transaction.</p> |
| version<mark style="color:red;">\*</mark> | String | 3                                                                                           |
| format                                    | String | json (Default), xml                                                                         |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

#### Request Body

| Name                                           | Type                | Description                                                                                                                                                                                                                                                                      |
| ---------------------------------------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contactname                                    | String              | Contact Name                                                                                                                                                                                                                                                                     |
| contactidnumber                                | String              | Contact ID Number/Tax ID                                                                                                                                                                                                                                                         |
| contactemail                                   | String              | Contact Email                                                                                                                                                                                                                                                                    |
| contactphone                                   | String              | Contact Phone                                                                                                                                                                                                                                                                    |
| contactaddress                                 | String              | Contact Address                                                                                                                                                                                                                                                                  |
| paymentamount                                  | Double              | <p>Payment Amount</p><p>("paymentmethod" must be required.)</p>                                                                                                                                                                                                                  |
| paymentmethod                                  | String              | Payment Method                                                                                                                                                                                                                                                                   |
| expensedate                                    | String              | <p>Expense Date<br>Ex. "2021-09-15"</p>                                                                                                                                                                                                                                          |
| vattype                                        | Int                 | <p>Vat Type <br>1 – No Vat<br>2 – Exclude Vat<br>3 – Include Vat<br>If vattype is not defined, the system will use vatamount to calculate and define automatically.<br>If vattype = 1, 2 or 3, the system will ignore vatamount and calculate vatamount value automatically.</p> |
| vatamount                                      | Double              | Vat Amount                                                                                                                                                                                                                                                                       |
| amount<mark style="color:red;">\*</mark>       | Double              | Net Amount                                                                                                                                                                                                                                                                       |
| contactbranchno                                | String              | Contact Branch No                                                                                                                                                                                                                                                                |
| contactbranchname                              | String              | Contact Branch Name                                                                                                                                                                                                                                                              |
| ∟ name<mark style="color:red;">\*</mark>       | String              | Item Name                                                                                                                                                                                                                                                                        |
| list                                           | ExpenseItem (Array) | Item List                                                                                                                                                                                                                                                                        |
| tag                                            | String (Array)      | Tag List (Array)                                                                                                                                                                                                                                                                 |
| discount                                       | String              | <p>Discount <br>Ex. 5.00, 10%</p>                                                                                                                                                                                                                                                |
| description                                    | String              | Description                                                                                                                                                                                                                                                                      |
| paymentdate                                    | String              | <p>Payment Datetime <br>Ex. “2021-09-15 21:05”</p>                                                                                                                                                                                                                               |
| ∟ categoryname                                 | String              | Item Category                                                                                                                                                                                                                                                                    |
| ∟ totalprice<mark style="color:red;">\*</mark> | Double              | Total Price                                                                                                                                                                                                                                                                      |
| reference                                      | String              | Reference                                                                                                                                                                                                                                                                        |

{% tabs %}
{% tab title="200: OK Success" %}
{% tabs %}
{% tab title="Response" %}

{% endtab %}

{% tab title="Ex. URL" %}
URL : <https://api.zortout.com/api.aspx?method=ADDEXPENSE&version=3>
{% endtab %}

{% tab title="Ex. Request JSON" %}

```
{
  "expensedate": "2021-05-31",
  "amount": 58,
  "vatamount": 0,
  "paymentmethod": "Cash",
  "list": [
    {
      "name": "Income1",
      "categoryname": "Others",
      "totalprice": 48
    },
    {
      "name": "Income2",
      "totalprice": 10
    }
  ]
}
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

| Parameter | Type   | Description/Example                   |
| --------- | ------ | ------------------------------------- |
| resCode   | String | <p>Response Code <br>200- Success</p> |
| resDesc   | String | Response Description                  |

## Update Expense Payment

<mark style="color:green;">`POST`</mark> `https://api.zortout.com/api.aspx`

Update payment of expense.

#### Query Parameters

| Name                                            | Type   | Description                                        |
| ----------------------------------------------- | ------ | -------------------------------------------------- |
| method<mark style="color:red;">\*</mark>        | String | “UPDATEEXPENSEPAYMENT”                             |
| paymentdate                                     | String | <p>Payment Datetime <br>Ex. “2021-09-15 21:05”</p> |
| paymentamount<mark style="color:red;">\*</mark> | Double | Payment Amount                                     |
| paymentmethod<mark style="color:red;">\*</mark> | String | Payment Method                                     |
| id<mark style="color:red;">\*</mark>            | Int    | Expense ID                                         |
| version<mark style="color:red;">\*</mark>       | String | 3                                                  |
| format                                          | String | json (Default), xml                                |

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| storename<mark style="color:red;">\*</mark> | String | Store Name  |
| apikey<mark style="color:red;">\*</mark>    | String | API Key     |
| apisecret<mark style="color:red;">\*</mark> | String | API Secret  |

{% tabs %}
{% tab title="200: OK Success" %}
{% tabs %}
{% tab title="Response" %}

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

| Parameter | Type   | Description/Example                   |
| --------- | ------ | ------------------------------------- |
| resCode   | String | <p>Response Code <br>200- Success</p> |
| resDesc   | String | Response Description                  |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers-v3.zortout.com/api-reference/finance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
