# 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 %}

## 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 %}

## 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 %}

## 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 %}

## 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 %}

## 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 %}

## 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 %}

## 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 %}
