# Webhook

### Common Request Parameters

{% hint style="info" %}
Your Endpoint URL
{% endhint %}

Every request will be sent with Header to endpoint URL.

#### Header

| Parameter     | Description     |
| ------------- | --------------- |
| Authorization | Basic {key1}    |
| key1          | Key Reference 1 |
| key2          | Key Reference 2 |
| key3          | Key Reference 3 |

{% hint style="warning" %}
A trigger with by API request will be not sent to webhook that use the same API Key.
{% endhint %}

### How To Set Webhook

* Set manually in ZORT portal.

1. Login to ZORT.
2. Go to menu Setting --> Integration --> API Reference --> Webhook.
3. Input key and endpoint URL and click "Verify and Save".

* Set by calling API.

You can send request to update webhook information.

## UPDATEWEBHOOK

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

Update webhook information.

#### Query Parameters

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

#### 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                                                                                                                                                      |
| -------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| key1<mark style="color:red;">\*</mark> | String | Key Reference 1                                                                                                                                                  |
| key2<mark style="color:red;">\*</mark> | String | Key Reference 2                                                                                                                                                  |
| key3<mark style="color:red;">\*</mark> | String | Key Reference 3                                                                                                                                                  |
| addproducturl                          | String | <p>Endpoint URL when product is created.<br>If this value is null or blank, this trigger will be not active.</p>                                                 |
| updateproducturl                       | String | <p>Endpoint URL when product is modified.<br>If this value is null or blank, this trigger will be not active.</p>                                                |
| deleteproducturl                       | String | <p>Endpoint URL when product is deleted.<br>If this value is null or blank, this trigger will be not active.</p>                                                 |
| updatequantityurl                      | String | <p>Endpoint URL when product quantity is changed.<br>If this value is null or blank, this trigger will be not active.</p>                                        |
| addorderurl                            | String | <p>Endpoint URL when order is created.<br>If this value is null or blank, this trigger will be not active.</p>                                                   |
| updateorderurl                         | String | <p>Endpoint URL when order is modified or an order status is changed.<br>If this value is null or blank, this trigger will be not active.</p>                    |
| updateordertrackingurl                 | String | <p>Endpoint URL when tracking no in order is changed.<br>If this value is null or blank, this trigger will be not active.</p>                                    |
| updateorderpaymenturl                  | String | <p>Endpoint URL when payments in order is changed.<br>If this value is null or blank, this trigger will be not active.</p>                                       |
| addpurchaseurl                         | String | <p>Endpoint URL when purchase is created.<br>If this value is null or blank, this trigger will be not active.</p>                                                |
| updatepurchaseurl                      | String | <p>Endpoint URL when purchase is modified or a purchase status is changed.<br>If this value is null or blank, this trigger will be not active.</p>               |
| updatepurchasepaymenturl               | String | <p>Endpoint URL when payments in purchase is changed.<br>If this value is null or blank, this trigger will be not active.</p>                                    |
| addreturnorderurl                      | String | <p>Endpoint URL when return order is created.<br>If this value is null or blank, this trigger will be not active.</p>                                            |
| updatereturnorderurl                   | String | <p>Endpoint URL when return order is modified or a return order status is changed.<br>If this value is null or blank, this trigger will be not active.</p>       |
| updatereturnorderpaymenturl            | String | <p>Endpoint URL when payments in return order is changed.<br>If this value is null or blank, this trigger will be not active.</p>                                |
| addreturnpurchaseurl                   | String | <p>Endpoint URL when return purchase is created.<br>If this value is null or blank, this trigger will be not active.</p>                                         |
| updatereturnpurchaseurl                | String | <p>Endpoint URL when return purchase is modified or a return purchase status is changed.<br>If this value is null or blank, this trigger will be not active.</p> |
| updatereturnpurchasepaymenturl         | String | <p>Endpoint URL when payments in return purchase is changed.<br>If this value is null or blank, this trigger will be not active.</p>                             |
| addtransferurl                         | String | <p>Endpoint URL when transfer is created.<br>If this value is null or blank, this trigger will be not active.</p>                                                |
| updatetransferurl                      | String | <p>Endpoint URL when transfer is modified or a transfer status is changed.<br>If this value is null or blank, this trigger will be not active.</p>               |

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

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

<table><thead><tr><th width="155.00000000000003">Parameter</th><th width="150">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>resCode</td><td>String</td><td>Response Code <br>200- Success</td></tr><tr><td>resDesc</td><td>String</td><td>Response Description</td></tr></tbody></table>

* You can get current webhook information by calling "**GETWEBHOOK**" method.

## GETWEBHOOK

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

Get webhook information.

#### Query Parameters

| Name                                      | Type   | Description         |
| ----------------------------------------- | ------ | ------------------- |
| method<mark style="color:red;">\*</mark>  | String | "GETWEBHOOK"        |
| format                                    | String | json (Default), xml |
| version<mark style="color:red;">\*</mark> | 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 %}

<table><thead><tr><th width="320">Parameter</th><th width="150">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>key1</td><td>String</td><td>Key Reference 1</td></tr><tr><td>key2</td><td>String</td><td>Key Reference 2</td></tr><tr><td>key3</td><td>String</td><td>Key Reference 3</td></tr><tr><td>addproducturl</td><td>String</td><td>Endpoint URL when product is created.</td></tr><tr><td>updateproducturl</td><td>String</td><td>Endpoint URL when product is modified.</td></tr><tr><td>deleteproducturl</td><td>String</td><td>Endpoint URL when product is deleted.</td></tr><tr><td>updatequantityurl</td><td>String</td><td>Endpoint URL when product quantity is changed.</td></tr><tr><td>addorderurl</td><td>String</td><td>Endpoint URL when order is create</td></tr><tr><td>updateorderurl</td><td>String</td><td>Endpoint URL when order is modified or an order status is changed.</td></tr><tr><td>updateordertrackingurl</td><td>String</td><td>Endpoint URL when tracking no in order is changed.</td></tr><tr><td>updateorderpaymenturl</td><td>String</td><td>Endpoint URL when payments in order is changed.</td></tr><tr><td>addpurchaseurl</td><td>String</td><td>Endpoint URL when purchase is created</td></tr><tr><td>updatepurchaseurl</td><td>String</td><td>Endpoint URL when purchase is modified or a purchase status is changed.</td></tr><tr><td>updatepurchasepaymenturl</td><td>String</td><td>Endpoint URL when payments in purchase is changed.</td></tr><tr><td>addreturnorderurl</td><td>String</td><td>Endpoint URL when return order is created.</td></tr><tr><td>updatereturnorderurl</td><td>String</td><td>Endpoint URL when return order is modified or a return order status is changed.</td></tr><tr><td>updatereturnorderpaymenturl</td><td>String</td><td>Endpoint URL when payments in return order is changed.</td></tr><tr><td>addreturnpurchaseurl</td><td>String</td><td>Endpoint URL when return purchase is created.</td></tr><tr><td>updatereturnpurchaseurl</td><td>String</td><td>Endpoint URL when return purchase is modified or a return purchase status is changed.</td></tr><tr><td>updatereturnpurchasepaymenturl</td><td>String</td><td>Endpoint URL when payments in return purchase is changed.</td></tr><tr><td>addtransferurl</td><td>String</td><td>Endpoint URL when transfer is created.</td></tr><tr><td>updatetransferurl</td><td>String</td><td>Endpoint URL when transfer is modified or a transfer status is changed.</td></tr></tbody></table>

### Trigger

{% hint style="success" %}

#### **Product Trigger**

{% endhint %}

## ADDPRODUCT

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a product is created.

#### Query Parameters

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| method<mark style="color:red;">\*</mark> | String | ADDPRODUCT  |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "sku": "P0001",
  "name": "Product1",
  "sellprice": "20.00",
  "purchaseprice": "10.00",
  "unittext": "Piece",
  "weight": "500",
  "barcode": "1234",
  "category": "test category"
}
```

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

## UPDATEPRODUCT

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a product is modified.

#### Query Parameters

| Name                                     | Type   | Description   |
| ---------------------------------------- | ------ | ------------- |
| method<mark style="color:red;">\*</mark> | String | UPDATEPRODUCT |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "sku": "P0001",
  "name": "Product1",
  "sellprice": "20.00",
  "purchaseprice": "10.00",
  "unittext": "Piece",
  "weight": "500",
  "barcode": "1234",
  "category": "test category"
}
```

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

## UPDATEPRODUCTQUANTITY

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a product quantity is changed.

#### Query Parameters

| Name                                     | Type   | Description           |
| ---------------------------------------- | ------ | --------------------- |
| method<mark style="color:red;">\*</mark> | String | UPDATEPRODUCTQUANTITY |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "sku": "P0001",
  "name": "Product1",
  "stock": "20.00",
  "availablestock": "10.00"
}
```

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

## DELETEPRODUCT

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a product is deleted.

#### Query Parameters

| Name                                     | Type   | Description   |
| ---------------------------------------- | ------ | ------------- |
| method<mark style="color:red;">\*</mark> | String | DELETEPRODUCT |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "sku": "P0001"
}
```

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

{% hint style="success" %}

#### Order Trigger

{% endhint %}

## ADDORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when an order is created.

#### Query Parameters

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| method<mark style="color:red;">\*</mark> | String | ADDORDER    |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "SO-0001",
  "orderdate": "/Date(1644944400000)/",
  "orderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Customer Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "customerbranchname": null,
  "customerbranchno": null,
  "shippingdate": null,
  "shippingchannel": null,
  "shippingamount": null,
  "shippingvat": null,
  "shippingname": null,
  "shippingaddress": null,
  "shippingphone": null,
  "shippingemail": null,
  "trackingno": null,
  "saleschannel": null,
  "description": null,
  "reference": null,
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success",
  "isCOD": false
}
```

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

## UPDATEORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when an order is modified or an order status is changed.

#### Query Parameters

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| method<mark style="color:red;">\*</mark> | String | UPDATEORDER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "SO-0001",
  "orderdate": "/Date(1644944400000)/",
  "orderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Customer Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "customerbranchname": null,
  "customerbranchno": null,
  "shippingdate": null,
  "shippingchannel": null,
  "shippingamount": null,
  "shippingvat": null,
  "shippingname": null,
  "shippingaddress": null,
  "shippingphone": null,
  "shippingemail": null,
  "trackingno": null,
  "saleschannel": null,
  "description": null,
  "reference": null,
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success",
  "isCOD": false
}
```

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

## UPDATEORDERPAYMENT

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when payments in order is changed.

#### Query Parameters

| Name                                            | Type   | Description                                                     |
| ----------------------------------------------- | ------ | --------------------------------------------------------------- |
| method<mark style="color:red;">\*</mark>        | String | UPDATEORDERPAYMENT                                              |
| id<mark style="color:red;">\*</mark>            | Int    | Order ID                                                        |
| number<mark style="color:red;">\*</mark>        | String | Order Number                                                    |
| paymentstatus<mark style="color:red;">\*</mark> | String | Payment Status (Pending, Paid, Partial Payment, Excess Payment) |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "SO-0001",
  "orderdate": "/Date(1644944400000)/",
  "orderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Customer Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "customerbranchname": null,
  "customerbranchno": null,
  "shippingdate": null,
  "shippingchannel": null,
  "shippingamount": null,
  "shippingvat": null,
  "shippingname": null,
  "shippingaddress": null,
  "shippingphone": null,
  "shippingemail": null,
  "trackingno": null,
  "saleschannel": null,
  "description": null,
  "reference": null,
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success",
  "isCOD": false
}
```

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

## UPDATEORDERTRACKING

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a tracking no in order is changed.

#### Query Parameters

| Name                                     | Type   | Description         |
| ---------------------------------------- | ------ | ------------------- |
| method<mark style="color:red;">\*</mark> | String | UPDATEORDERTRACKING |
| id<mark style="color:red;">\*</mark>     | Int    | Order ID            |
| number<mark style="color:red;">\*</mark> | String | Order Number        |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
[
  {
    "trackingno": "THP0001",
    "trackingurl": "",
    "shippingdate": null
  }
]
```

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

## DELETEORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when an order is deleted.

#### Query Parameters

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| method<mark style="color:red;">\*</mark> | String | DELETEORDER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "SO-0001"
}
```

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

{% hint style="success" %}
**Purchase Order Trigger**
{% endhint %}

## ADDPURCHASEORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a purchase is created.

#### Query Parameters

| Name                                     | Type   | Description      |
| ---------------------------------------- | ------ | ---------------- |
| method<mark style="color:red;">\*</mark> | String | ADDPURCHASEORDER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "PO-0001",
  "purchaseorderdate": "/Date(1644944400000)/",
  "purchaseorderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Customer Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "description": null,
  "reference": null,
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success"
}
```

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

## UPDATEPURCHASEORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a purchase is modified or a purchase status is changed.

#### Query Parameters

| Name                                     | Type   | Description         |
| ---------------------------------------- | ------ | ------------------- |
| method<mark style="color:red;">\*</mark> | String | UPDATEPURCHASEORDER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "PO-0001",
  "purchaseorderdate": "/Date(1644944400000)/",
  "purchaseorderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Customer Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "description": null,
  "reference": null,
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success"
}
```

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

## UPDATEPURCHASEORDERPAYMENT

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when payments in purchase is changed.

#### Query Parameters

| Name                                            | Type   | Description                                                     |
| ----------------------------------------------- | ------ | --------------------------------------------------------------- |
| method<mark style="color:red;">\*</mark>        | String | UPDATEPURCHASEORDERPAYMENT                                      |
| id<mark style="color:red;">\*</mark>            | Int    | PurchaseOrder ID                                                |
| number<mark style="color:red;">\*</mark>        | String | PurchaseOrder Number                                            |
| paymentstatus<mark style="color:red;">\*</mark> | String | Payment Status (Pending, Paid, Partial Payment, Excess Payment) |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "PO-0001",
  "purchaseorderdate": "/Date(1644944400000)/",
  "purchaseorderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Customer Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "description": null,
  "reference": null,
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success"
}
```

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

## DELETEPURCHASEORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when an purchase is deleted.

#### Query Parameters

| Name                                     | Type   | Description         |
| ---------------------------------------- | ------ | ------------------- |
| method<mark style="color:red;">\*</mark> | String | DELETEPURCHASEORDER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "PO-0001"
}
```

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

{% hint style="success" %}
**Return Order Trigger**
{% endhint %}

## ADDRETURNORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a return order is created.

#### Query Parameters

| Name                                     | Type   | Description    |
| ---------------------------------------- | ------ | -------------- |
| method<mark style="color:red;">\*</mark> | String | ADDRETURNORDER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "CN-0001",
  "returnorderdate": "/Date(1644944400000)/",
  "returnorderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Customer Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "description": null,
  "reference": "SO-0001",
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success",
  "referenceid": 2345
}
```

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

## UPDATERETURNORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a return order is modified or a return order status is changed.

#### Query Parameters

| Name                                     | Type   | Description       |
| ---------------------------------------- | ------ | ----------------- |
| method<mark style="color:red;">\*</mark> | String | UPDATERETURNORDER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "CN-0001",
  "returnorderdate": "/Date(1644944400000)/",
  "returnorderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Customer Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "description": null,
  "reference": "SO-0001",
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success",
  "referenceid": 2345
}
```

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

## UPDATERETURNORDERPAYMENT

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when payments in return order is changed.

#### Query Parameters

| Name                                            | Type   | Description                                                     |
| ----------------------------------------------- | ------ | --------------------------------------------------------------- |
| method<mark style="color:red;">\*</mark>        | String | UPDATERETURNORDERPAYMENT                                        |
| id<mark style="color:red;">\*</mark>            | Int    | ReturnOrder ID                                                  |
| number<mark style="color:red;">\*</mark>        | String | ReturnOrder Number                                              |
| paymentstatus<mark style="color:red;">\*</mark> | String | Payment Status (Pending, Paid, Partial Payment, Excess Payment) |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "CN-0001",
  "returnorderdate": "/Date(1644944400000)/",
  "returnorderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Customer Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "description": null,
  "reference": "SO-0001",
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success",
  "referenceid": 2345
}
```

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

## DELETERETURNORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when an return order is deleted.

#### Query Parameters

| Name                                     | Type   | Description       |
| ---------------------------------------- | ------ | ----------------- |
| method<mark style="color:red;">\*</mark> | String | DELETERETURNORDER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "CN-0001"
}
```

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

{% hint style="success" %}
**Return Purchase Order Trigger**
{% endhint %}

## ADDRETURNPURCHASEORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a return purchase is created.

#### Query Parameters

| Name                                     | Type   | Description            |
| ---------------------------------------- | ------ | ---------------------- |
| method<mark style="color:red;">\*</mark> | String | ADDRETURNPURCHASEORDER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "DN-0001",
  "returnpurchaseorderdate": "/Date(1644944400000)/",
  "returnpurchaseorderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Contact Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "description": null,
  "reference": "PO-0001",
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success",
  "referenceid": 2345
}
```

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

## UPDATERETURNPURCHASEORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a return purchase is modified or a return purchase status is changed.

#### Query Parameters

| Name                                     | Type   | Description               |
| ---------------------------------------- | ------ | ------------------------- |
| method<mark style="color:red;">\*</mark> | String | UPDATERETURNPURCHASEORDER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "DN-0001",
  "returnpurchaseorderdate": "/Date(1644944400000)/",
  "returnpurchaseorderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Contact Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "description": null,
  "reference": "PO-0001",
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success",
  "referenceid": 2345
}
```

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

## UPDATERETURNPURCHASEORDERPAYMENT

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when payments in return purchase is changed.

#### Query Parameters

| Name                                            | Type   | Description                                                     |
| ----------------------------------------------- | ------ | --------------------------------------------------------------- |
| method<mark style="color:red;">\*</mark>        | String | UPDATERETURNPURCHASEORDERPAYMENT                                |
| id<mark style="color:red;">\*</mark>            | Int    | ReturnPurchaseOrder ID                                          |
| number<mark style="color:red;">\*</mark>        | String | ReturnPurchaseOrder Number                                      |
| paymentstatus<mark style="color:red;">\*</mark> | String | Payment Status (Pending, Paid, Partial Payment, Excess Payment) |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "DN-0001",
  "returnpurchaseorderdate": "/Date(1644944400000)/",
  "returnpurchaseorderdateString": "2022-02-16",
  "customerid": 123,
  "customername": "Contact Name",
  "customeridnumber": null,
  "customerphone": null,
  "customeremail": null,
  "customeraddress": null,
  "description": null,
  "reference": "PO-0001",
  "vattype": 1,
  "list": [
    {
      "productid": 2345,
      "sku": "P0001",
      "name": "Product 1",
      "number": 1,
      "pricepernumber": 100,
      "discount": null,
      "totalprice": 100
    },
    {
      "productid": 4567,
      "sku": "P0002",
      "name": "Product 2",
      "number": 1,
      "pricepernumber": 50,
      "discount": null,
      "totalprice": 50
    }
  ],
  "discount": null,
  "vatamount": null,
  "amount": 150,
  "paymentamount": 150,
  "paymentstatus": "Paid",
  "status": "Success",
  "referenceid": 2345
}
```

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

## DELETERETURNPURCHASEORDER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when an return purchase is deleted.

#### Query Parameters

| Name                                     | Type   | Description               |
| ---------------------------------------- | ------ | ------------------------- |
| method<mark style="color:red;">\*</mark> | String | DELETERETURNPURCHASEORDER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "DO-0001"
}
```

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

{% hint style="success" %}
**Transfer**
{% endhint %}

## ADDTRANSFER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a transfer is created.

#### Query Parameters

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| method<mark style="color:red;">\*</mark> | String | ADDTRANSFER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "TF-0001",
  "status": "Success",
  "transferdate": "2021-01- 25",
  "fromwarehousecode": "W0001",
  "towarehousecode": "W0002",
  "list": [
    {
      "sku": "P0001",
      "name": "Product1",
      "number": "5"
    },
    {
      "sku": "P0002",
      "name": "Product2",
      "number": "3"
    }
  ]
}
```

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

## UPDATETRANSFER

<mark style="color:green;">`POST`</mark> `{Your Endpoint URL}`

Send request when a transfer is modified or a transfer status is changed.

#### Query Parameters

| Name                                     | Type   | Description    |
| ---------------------------------------- | ------ | -------------- |
| method<mark style="color:red;">\*</mark> | String | UPDATETRANSFER |

#### Request Body

| Name                                      | Type   | Description                                                        |
| ----------------------------------------- | ------ | ------------------------------------------------------------------ |
| payload<mark style="color:red;">\*</mark> | String | <p>Payload (JSON format)</p><p>See detail in Ex. Payload JSON.</p> |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Ex. Payload JSON" %}

```
{
  "id": 1234,
  "number": "TF-0001",
  "status": "Success",
  "transferdate": "2021-01- 25",
  "fromwarehousecode": "W0001",
  "towarehousecode": "W0002",
  "list": [
    {
      "sku": "P0001",
      "name": "Product1",
      "number": "5"
    },
    {
      "sku": "P0002",
      "name": "Product2",
      "number": "3"
    }
  ]
}
```

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


---

# 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/overview/webhook.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.
