# Return Purchase Order

## Get Return Purchase Orders

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/ReturnPurchaseOrder/GetReturnPurchaseOrders`

Get list of return purchase orders.

#### Query Parameters

| Name                          | Type   | Description                                                    |
| ----------------------------- | ------ | -------------------------------------------------------------- |
| returnpurchaseorderdateafter  | String | <p>Return Purchase Order Date After .....<br>(yyyy-MM-dd)</p>  |
| returnpurchaseorderdatebefore | String | <p>Return Purchase Order Date Before .....<br>(yyyy-MM-dd)</p> |
| topaymentamount               | Double | Maximum payment amount                                         |
| frompaymentamount             | Double | Minimum payment amount                                         |
| toamount                      | Double | Maximum amount                                                 |
| fromamount                    | Double | Minimum amount                                                 |
| updatedatetimeafter           | String | <p>Updated Datetime After .....<br>(yyyy-MM-dd HH:mm)</p>      |
| updatedatetimebefore          | String | <p>Updated Datetime Before .....<br>(yyyy-MM-dd HH:mm)</p>     |
| createdatetimeafter           | String | <p>Created Datetime After .....<br>(yyyy-MM-dd HH:mm)</p>      |
| createdatetimebefore          | String | <p>Created Datetime Before .....<br>(yyyy-MM-dd HH:mm)</p>     |
| paymentafter                  | String | <p>Paid Date After .....<br>(yyyy-MM-dd)</p>                   |
| paymentbefore                 | String | <p>Paid Date Before .....<br>(yyyy-MM-dd)</p>                  |
| updatedafter                  | String | <p>Updated Date After .....<br>(yyyy-MM-dd)</p>                |
| updatedbefore                 | String | <p>Updated Date Before .....<br>(yyyy-MM-dd)</p>               |
| createdafter                  | String | <p>Created Date After .....<br>(yyyy-MM-dd)</p>                |
| createdbefore                 | String | <p>Created Date Before .....<br>(yyyy-MM-dd)</p>               |
| limit                         | Int    | Limit per page (Max = 500)                                     |
| page                          | Int    | Page (Default = 1)                                             |
| keyword                       | String | Keyword to search                                              |
| createusername                | String | Created by (Username)                                          |
| warehousecode                 | String | Warehouse Code                                                 |

#### 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                                                      |
| returnpurchaseorderidlist                   | String | List Of Return Purchase Order ID Ex. “123,124,125”              |
| numberlist                                  | String | List Of Return Purchase Order Number Ex. “DN-001,DN-002,DN-003” |

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

<table><thead><tr><th width="150">Parameter</th><th width="150">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>res</td><td>Response</td><td>Response Code <br>200- Success</td></tr><tr><td>list</td><td>ReturnPurchaseOrder (Array)</td><td>Return Purchase Order List (Array)</td></tr><tr><td>count</td><td>Int</td><td>Total return purchase order number by filter</td></tr><tr><td>totalAmount</td><td>Double</td><td>Total amount by filter</td></tr><tr><td>totalPaymentAmount</td><td>Double</td><td>Total payment amount by filter</td></tr></tbody></table>

<table><thead><tr><th width="166.38324777353165">ReturnPurchaseOrder (Array)</th><th width="150">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>id</td><td>Int</td><td>Return Purchase Order ID</td></tr><tr><td>number</td><td>String</td><td>Return Purchase Order Number</td></tr><tr><td>customerid</td><td>Int</td><td>Contact ID</td></tr><tr><td>customercode</td><td>String</td><td>Contact Code</td></tr><tr><td>customername</td><td>String</td><td>Contact Name</td></tr><tr><td>customeridnumber</td><td>String</td><td>Contact ID Number/Tax ID</td></tr><tr><td>customeremail</td><td>String</td><td>Contact Email</td></tr><tr><td>customerphone</td><td>String</td><td>Contact Phone</td></tr><tr><td>customeraddress</td><td>String</td><td>Contact Address</td></tr><tr><td>customerbranchname</td><td>String</td><td>Contact Branch Name</td></tr><tr><td>customerbranchno</td><td>String</td><td>Contact Branch No</td></tr><tr><td>status</td><td>String</td><td><p>Status (Pending,</p><p>Waiting, Shipping, Success, Partial Transfer, Voided)</p></td></tr><tr><td>paymentstatus</td><td>String</td><td>Payment Status (Pending, Paid, Partial Payment, Excess Payment)</td></tr><tr><td>amount</td><td>Double</td><td>Net Amount</td></tr><tr><td>amount_pretax</td><td></td><td>Pretax Amount</td></tr><tr><td>vatamount</td><td>Double</td><td>Vat Amount</td></tr><tr><td>shippingamount</td><td>Double</td><td>Shipping Amount</td></tr><tr><td>shippingamount_pretax</td><td>Double</td><td>Pretax Shipping Amount</td></tr><tr><td>shippingamount_vat</td><td>Double</td><td>Shipping Vat Amount</td></tr><tr><td>shippingvat</td><td>Int</td><td>Shipping Vat Status <br>0 - No Shipping Vat <br>1 - Have Shipping Vat</td></tr><tr><td>returnpurchaseorderdate</td><td>Date</td><td>Return Purchase Order Date</td></tr><tr><td>returnpurchaseorderdateString</td><td>String</td><td>Return Purchase Order Date Text <br>(yyyy-MM-dd)</td></tr><tr><td>paymentamount</td><td>Double</td><td>Payment Amount</td></tr><tr><td>reference</td><td>String</td><td>Reference</td></tr><tr><td>description</td><td>String</td><td>Description</td></tr><tr><td>discount</td><td>String</td><td>Discount <br>Ex.5.00, 10%</td></tr><tr><td>discountamount</td><td>Double</td><td>Total summary of return purchase order discount.</td></tr><tr><td>discountamount_pretax</td><td>Double</td><td>Total summary of pretax return purchase order discount.</td></tr><tr><td>discountamount_vat</td><td>Double</td><td>Total summary of return purchase order vat.</td></tr><tr><td>vattype</td><td>Int</td><td>Vat Type <br>1 – No Vat (Default) <br>2 – Exclude Vat <br>3 – Include Vat</td></tr><tr><td>warehousecode</td><td>String</td><td>Warehouse Code</td></tr><tr><td>list</td><td>ReturnPurchaseOrderProduct (Array)</td><td>Product List</td></tr><tr><td>payments</td><td>Payment (Array)</td><td>Payment List</td></tr><tr><td>tag</td><td>String (Array)</td><td>Tag List (Array)</td></tr><tr><td>createdatetime</td><td>Datetime</td><td>Created Datetime</td></tr><tr><td>createdatetimeString</td><td>String</td><td>Created Datetime Text <br>(yyyy-MM-dd HH:mm)</td></tr><tr><td>updatedatetime</td><td>Datetime</td><td>Updated Datetime</td></tr><tr><td>updatedatetimeString</td><td>String</td><td>Updated Datetime Text <br>(yyyy-MM-dd HH:mm)</td></tr><tr><td>createuserid</td><td>Int</td><td>Created User ID</td></tr><tr><td>createusername</td><td>String</td><td>Created User (Username)</td></tr><tr><td>createdby</td><td>String</td><td>Created User (Display name)</td></tr><tr><td>referenceid</td><td>Int</td><td>Reference Purchase Order ID</td></tr><tr><td>referencenumber</td><td>String</td><td>Reference Purchase Order Number</td></tr><tr><td>currency</td><td>String</td><td>Currency</td></tr></tbody></table>

<table><thead><tr><th width="221.55578110023964">ReturnPurchaseOrderProduct (Array)</th><th width="150">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>productid</td><td>Int</td><td>Product ID</td></tr><tr><td>sku</td><td>String</td><td>Product Sku</td></tr><tr><td>name</td><td>String</td><td>Product Name</td></tr><tr><td>number</td><td>Double</td><td>Product Quantity</td></tr><tr><td>unittext</td><td>String</td><td>Unit</td></tr><tr><td>pricepernumber</td><td>Double</td><td>Product Price/Quantity</td></tr><tr><td>pricepernumber_pretax</td><td>Double</td><td>Pretax Product Price/Quantity</td></tr><tr><td>pricepernumber_vat</td><td>Double</td><td>Product Vat/Quantity</td></tr><tr><td>discount</td><td>String</td><td>Discount Per Unit</td></tr><tr><td>discountamount</td><td>Double</td><td>Total discount of product line.</td></tr><tr><td>discountamount_pretax</td><td>Double</td><td>Total pretax discount of product line.</td></tr><tr><td>discountamount_vat</td><td>Double</td><td>Total discount vat of product line.</td></tr><tr><td>totalprice</td><td>Double</td><td>Total Price</td></tr><tr><td>totalprice_pretax</td><td>Double</td><td>Pretax Total Price</td></tr><tr><td>totalprice_vat</td><td>Double</td><td>Total Vat</td></tr></tbody></table>

<table><thead><tr><th width="235.92198438788907">Payment (Array)</th><th width="150">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>id</td><td>Int</td><td>Payment ID</td></tr><tr><td>name</td><td>String</td><td>Payment Method Name</td></tr><tr><td>amount</td><td>Double</td><td>Payment Amount</td></tr><tr><td>paymentdatetime</td><td>Datetime</td><td>Payment Datetime</td></tr><tr><td>paymentdatetimeString</td><td>String</td><td>Payment Datetime Text <br>(yyyy-MM-dd HH:mm)</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

## Get Return Purchase Order Detail

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/ReturnPurchaseOrder/GetReturnPurchaseOrderDetail`

Get return purchase order detail.

#### Query Parameters

| Name                                 | Type | Description              |
| ------------------------------------ | ---- | ------------------------ |
| id<mark style="color:red;">\*</mark> | Int  | Return Purchase Order 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="Response" %}

<table><thead><tr><th width="207.33333333333331">Parameter</th><th>Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>id</td><td>Int</td><td>Return Purchase Order ID</td></tr><tr><td>number</td><td>String</td><td>Return Purchase Order Number</td></tr><tr><td>customerid</td><td>Int</td><td>Contact ID</td></tr><tr><td>customercode</td><td>String</td><td>Contact Code</td></tr><tr><td>customername</td><td>String</td><td>Contact Name</td></tr><tr><td>customeridnumber</td><td>String</td><td>Contact ID Number/Tax ID</td></tr><tr><td>customeremail</td><td>String</td><td>Contact Email</td></tr><tr><td>customerphone</td><td>String</td><td>Contact Phone</td></tr><tr><td>customeraddress</td><td>String</td><td>Contact Address</td></tr><tr><td>customerbranchname</td><td>String</td><td>Contact Branch Name</td></tr><tr><td>customerbranchno</td><td>String</td><td>Contact Branch No</td></tr><tr><td>status</td><td>String</td><td><p>Status (Pending,</p><p>Waiting, Shipping, Success, Partial Transfer, Voided)</p></td></tr><tr><td>paymentstatus</td><td>String</td><td>Payment Status (Pending, Paid, Partial Payment, Excess Payment)</td></tr><tr><td>amount</td><td>Double</td><td>Net Amount</td></tr><tr><td>amount_pretax</td><td></td><td>Pretax Amount</td></tr><tr><td>vatamount</td><td>Double</td><td>Vat Amount</td></tr><tr><td>shippingamount</td><td>Double</td><td>Shipping Amount</td></tr><tr><td>shippingamount_pretax</td><td>Double</td><td>Pretax Shipping Amount</td></tr><tr><td>shippingamount_vat</td><td>Double</td><td>Shipping Vat Amount</td></tr><tr><td>shippingvat</td><td>Int</td><td>Shipping Vat Status <br>0 - No Shipping Vat <br>1 - Have Shipping Vat</td></tr><tr><td>returnpurchaseorderdate</td><td>Date</td><td>Return Purchase Order Date</td></tr><tr><td>returnpurchaseorderdateString</td><td>String</td><td>Return Purchase Order Date Text <br>(yyyy-MM-dd)</td></tr><tr><td>paymentamount</td><td>Double</td><td>Payment Amount</td></tr><tr><td>reference</td><td>String</td><td>Reference</td></tr><tr><td>description</td><td>String</td><td>Description</td></tr><tr><td>discount</td><td>String</td><td>Discount <br>Ex.5.00, 10%</td></tr><tr><td>discountamount</td><td>Double</td><td>Total summary of return purchase order discount.</td></tr><tr><td>discountamount_pretax</td><td>Double</td><td>Total summary of pretax return purchase order discount.</td></tr><tr><td>discountamount_vat</td><td>Double</td><td>Total summary of return purchase order vat.</td></tr><tr><td>vattype</td><td>Int</td><td>Vat Type <br>1 – No Vat (Default) <br>2 – Exclude Vat <br>3 – Include Vat</td></tr><tr><td>warehousecode</td><td>String</td><td>Warehouse Code</td></tr><tr><td>list</td><td>ReturnPurchaseOrderProduct (Array)</td><td>Product List</td></tr><tr><td>payments</td><td>Payment (Array)</td><td>Payment List</td></tr><tr><td>tag</td><td>String (Array)</td><td>Tag List (Array)</td></tr><tr><td>createdatetime</td><td>Datetime</td><td>Created Datetime</td></tr><tr><td>createdatetime String</td><td>String</td><td>Created Datetime Text (yyyy-MM-dd HH:mm)</td></tr><tr><td>updatedatetime</td><td>Datetime</td><td>Updated Datetime</td></tr><tr><td>updatedatetimeString</td><td>String</td><td>Updated Datetime Text (yyyy-MM-dd HH:mm)</td></tr><tr><td>createuserid</td><td>Int</td><td>Created User ID</td></tr><tr><td>createusername</td><td>String</td><td>Created User (Username)</td></tr><tr><td>createdby</td><td>String</td><td>Created User (Display name)</td></tr><tr><td>referenceid</td><td>Int</td><td>Reference Purchase Order ID</td></tr><tr><td>referencenumber</td><td>String</td><td>Reference Purchase Order Number</td></tr><tr><td>currency</td><td>String</td><td>Currency</td></tr></tbody></table>

<table><thead><tr><th width="256.1492570884217">ReturnPurchaseOrderProduct (Array)</th><th width="150">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>productid</td><td>Int</td><td>Product ID</td></tr><tr><td>sku</td><td>String</td><td>Product Sku</td></tr><tr><td>name</td><td>String</td><td>Product Name</td></tr><tr><td>number</td><td>Double</td><td>Product Quantity</td></tr><tr><td>unittext</td><td>String</td><td>Unit</td></tr><tr><td>pricepernumber</td><td>Double</td><td>Product Price/Quantity</td></tr><tr><td>pricepernumber_pretax</td><td>Double</td><td>Pretax Product Price/Quantity</td></tr><tr><td>pricepernumber_vat</td><td>Double</td><td>Product Vat/Quantity</td></tr><tr><td>discount</td><td>String</td><td>Discount Per Unit</td></tr><tr><td>discountamount</td><td>Double</td><td>Total discount of product line.</td></tr><tr><td>discountamount_pretax</td><td>Double</td><td>Total pretax discount of product line.</td></tr><tr><td>discountamount_vat</td><td>Double</td><td>Total discount vat of product line.</td></tr><tr><td>totalprice</td><td>Double</td><td>Total Price</td></tr><tr><td>totalprice_pretax</td><td>Double</td><td>Pretax Total Price</td></tr><tr><td>totalprice_vat</td><td>Double</td><td>Total Vat</td></tr></tbody></table>

<table><thead><tr><th width="211.03517943691122">Payment (Array)</th><th width="150">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>id</td><td>Int</td><td>Payment ID</td></tr><tr><td>name</td><td>String</td><td>Payment Method Name</td></tr><tr><td>amount</td><td>Double</td><td>Payment Amount</td></tr><tr><td>paymentdatetime</td><td>Datetime</td><td>Payment Datetime</td></tr><tr><td>paymentdatetimeString</td><td>String</td><td>Payment Datetime Text <br>(yyyy-MM-dd HH:mm)</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

## Get Movement Return Purchase Order Detail

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/ReturnPurchaseOrder/GetMovementReturnPurchaseOrderDetail`

Get movement list of products according to each return purchase order.

#### Query Parameters

| Name                                 | Type | Description              |
| ------------------------------------ | ---- | ------------------------ |
| id<mark style="color:red;">\*</mark> | Int  | Return Purchase Order 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="Response" %}

| MovementReturnPurchaseOrder (Array) | Type                               | Description/Example                              |
| ----------------------------------- | ---------------------------------- | ------------------------------------------------ |
| id                                  | Int                                | ID                                               |
| list                                | ReturnPurchaseOrderProduct (Array) | Movement List                                    |
| actionDate                          | Date (Array)                       | List of action date                              |
| actionDateString                    | String (Array)                     | <p>List of action date text <br>(yyyy-MM-dd)</p> |
| returnpurchaseorderid               | Int                                | Return Purchase Order ID                         |

| ReturnPurchaseOrderProduct (Array) | Type   | Description/Example    |
| ---------------------------------- | ------ | ---------------------- |
| productid                          | Int    | Product ID             |
| sku                                | String | Product Sku            |
| name                               | String | Product Name           |
| number                             | Double | Product Quantity       |
| unittext                           | String | Unit                   |
| pricepernumber                     | Double | Product Price/Quantity |
| discount                           | String | Discount Per Unit      |
| totalprice                         | Double | Total Price            |
| {% endtab %}                       |        |                        |
| {% endtabs %}                      |        |                        |

## Get Movement Return Purchase Orders

<mark style="color:blue;">`GET`</mark> `https://open-api.zortout.com/v4/ReturnPurchaseOrder/GetMovementReturnPurchaseOrders`

Get movement list of products for return purchase orders.

#### Query Parameters

| Name                                         | Type   | Description                              |
| -------------------------------------------- | ------ | ---------------------------------------- |
| dateafter<mark style="color:red;">\*</mark>  | String | <p>Date After .....<br>(yyyy-MM-dd)</p>  |
| limit                                        | Int    | Limit per page (Max = 500)               |
| page                                         | Int    | Page (Default = 1)                       |
| warehousecode                                | String | Warehouse Code                           |
| datebefore<mark style="color:red;">\*</mark> | String | <p>Date Before .....<br>(yyyy-MM-dd)</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  |

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

| Parameter | Type                                | Description/Example                         |
| --------- | ----------------------------------- | ------------------------------------------- |
| res       | Response                            | <p>Response Code <br>200- Success</p>       |
| list      | MovementReturnPurchaseOrder (Array) | Movement Return Purchase Order List (Array) |
| count     | Int                                 | Total movement order number by filter       |

| MovementReturnPurchaseOrder (Array) | Type                               | Description/Example                              |
| ----------------------------------- | ---------------------------------- | ------------------------------------------------ |
| id                                  | Int                                | ID                                               |
| list                                | ReturnPurchaseOrderProduct (Array) | Movement List                                    |
| actionDate                          | Date (Array)                       | List of action date                              |
| actionDateString                    | String (Array)                     | <p>List of action date text <br>(yyyy-MM-dd)</p> |
| returnpurchaseorderid               | Int                                | Return Purchase Order ID                         |

| ReturnPurchaseOrderProduct (Array) | Type   | Description/Example    |
| ---------------------------------- | ------ | ---------------------- |
| productid                          | Int    | Product ID             |
| sku                                | String | Product Sku            |
| name                               | String | Product Name           |
| number                             | Double | Product Quantity       |
| unittext                           | String | Unit                   |
| pricepernumber                     | Double | Product Price/Quantity |
| discount                           | String | Discount Per Unit      |
| totalprice                         | Double | Total Price            |
| {% endtab %}                       |        |                        |
| {% endtabs %}                      |        |                        |

## Add Return Purchase Order

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/ReturnPurchaseOrder/AddReturnPurchaseOrder`

Add return purchase order.

#### 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                                                                                                                                                                                                                                                                      |
| -------------------------------------------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| number<mark style="color:red;">\*</mark>           | String                       | Return Purchase Order Number                                                                                                                                                                                                                                                     |
| vatamount                                          | Double                       | Vat Amount                                                                                                                                                                                                                                                                       |
| amount<mark style="color:red;">\*</mark>           | Double                       | Net Amount                                                                                                                                                                                                                                                                       |
| status                                             | String                       | <p>Status (Pending,Success) <br>Default - Pending</p>                                                                                                                                                                                                                            |
| reference                                          | String                       | Reference                                                                                                                                                                                                                                                                        |
| customeraddress                                    | String                       | Contact Address                                                                                                                                                                                                                                                                  |
| customerphone                                      | String                       | Contact Phone                                                                                                                                                                                                                                                                    |
| customeremail                                      | String                       | Contact Email                                                                                                                                                                                                                                                                    |
| customeridnumber                                   | String                       | Contact ID Number/Tax ID                                                                                                                                                                                                                                                         |
| customername                                       | String                       | Contact Name                                                                                                                                                                                                                                                                     |
| returnpurchaseorderdate                            | String                       | <p>Return Purchase Order Date</p><p>Ex. “2021-09-15”</p>                                                                                                                                                                                                                         |
| warehousecode                                      | String                       | Warehouse Code                                                                                                                                                                                                                                                                   |
| discount                                           | String                       | <p>Discount <br>Ex. 5.00, 10%</p>                                                                                                                                                                                                                                                |
| description                                        | String                       | Description                                                                                                                                                                                                                                                                      |
| paymentamount                                      | Double                       | <p>Payment amount</p><p>("paymentmethod" must be required.)</p>                                                                                                                                                                                                                  |
| paymentmethod                                      | String                       | Payment Method                                                                                                                                                                                                                                                                   |
| list                                               | PurchaseOrderProduct (Array) | Product List                                                                                                                                                                                                                                                                     |
| referenceid                                        | Int                          | Reference Purchase Order ID                                                                                                                                                                                                                                                      |
| referencenumber                                    | String                       | Reference Purchase Order Number                                                                                                                                                                                                                                                  |
| ∟ totalprice<mark style="color:red;">\*</mark>     | Double                       | ∟ Total Price                                                                                                                                                                                                                                                                    |
| ∟ discount                                         | String                       | Discount Per Unit                                                                                                                                                                                                                                                                |
| ∟ pricepernumber<mark style="color:red;">\*</mark> | Double                       | Product Price/Quantity                                                                                                                                                                                                                                                           |
| ∟ number<mark style="color:red;">\*</mark>         | Double                       | Product Quantity                                                                                                                                                                                                                                                                 |
| ∟ name<mark style="color:red;">\*</mark>           | String                       | Product Name                                                                                                                                                                                                                                                                     |
| ∟ sku<mark style="color:red;">\*</mark>            | String                       | Product Sku                                                                                                                                                                                                                                                                      |
| customercode                                       | String                       | Contact Code                                                                                                                                                                                                                                                                     |
| customerbranchno                                   | String                       | Contact Branch No                                                                                                                                                                                                                                                                |
| customerbranchname                                 | String                       | Contact Branch Name                                                                                                                                                                                                                                                              |
| shippingvat                                        | Int                          | <p>Shipping Vat Status <br>0 - No Shipping Vat (Default) <br>1 – Have Shipping Vat</p>                                                                                                                                                                                           |
| shippingamount                                     | Double                       | Shipping 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> |

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

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

<table><thead><tr><th>Detail</th><th width="178">Type</th><th>Description/Example</th></tr></thead><tbody><tr><td>id</td><td>Int</td><td>Return Purchase Order ID</td></tr></tbody></table>
{% endtab %}

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

<pre class="language-json"><code class="lang-json"><strong>{
</strong>   "number": "DN-0001",
   "customername": "Customer Name",
   "status": "Success",
   "amount": 105,
   "vatamount": 0,
   "returnpurchaseorderdate": "2021-05- 20",
   "paymentmethod": "KBANK",
   "paymentamount": 80,
   "list":[
      {
         "sku": "P0001",
         "name": "Product1",
         "number": 5,
         "pricepernumber": 20,
         "discount": "10%",
         "totalprice": 90
      },
      {
         "sku": "P0002",
         "name": "Product2",
         "number": 3,
         "pricepernumber": 10,
         "discount": "5",
         "totalprice": 15
      }
   ],
   "referencenumber": "SO-0001"
}
</code></pre>

{% endtab %}
{% endtabs %}

## Update Return Purchase Order Status

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/ReturnPurchaseOrder/UpdateReturnPurchaseOrderStatus`

Update status of return purchase order.

#### Query Parameters

| Name          | Type   | Description                                                                                         |
| ------------- | ------ | --------------------------------------------------------------------------------------------------- |
| id            | Int    | <p>Return Purchase Order ID</p><p>\*Must have either id or number</p>                               |
| statu         | Int    | <p>1 = Success (Default) <br>3 = Waiting <br>6 = Shipping</p>                                       |
| warehousecode | String | Warehouse Code                                                                                      |
| number        | String | <p>Return Purchase Order Number Require if id = 0 or null</p><p>\*Must have either id or number</p> |
| actionDate    | String | <p>Date of product transfer.<br>(yyyy-MM-dd)</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  |

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

| Parameter     | Type   | Description/Example                   |
| ------------- | ------ | ------------------------------------- |
| resCode       | String | <p>Response Code <br>200- Success</p> |
| resDesc       | String | Response Description                  |
| {% endtab %}  |        |                                       |
| {% endtabs %} |        |                                       |

## Update Return Purchase Order Payment

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/ReturnPurchaseOrder/UpdateReturnPurchaseOrderPayment`

Update payment of return purchase order.

#### Query Parameters

| Name                                            | Type   | Description                                                                                         |
| ----------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------- |
| id                                              | Int    | <p>Return Purchase Order ID</p><p>\*Must have either id or number</p>                               |
| 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                                                                                      |
| number                                          | String | <p>Return Purchase Order Number Require if id = 0 or null</p><p>\*Must have either id or number</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  |

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

| Parameter     | Type   | Description/Example                   |
| ------------- | ------ | ------------------------------------- |
| resCode       | String | <p>Response Code <br>200- Success</p> |
| resDesc       | String | Response Description                  |
| {% endtab %}  |        |                                       |
| {% endtabs %} |        |                                       |

## Void Return Purchase Order&#x20;

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/ReturnPurchaseOrder/VoidReturnPurchaseOrder`

Void return purchase order.

#### Path Parameters

| Name   | Type   | Description                                                                                         |
| ------ | ------ | --------------------------------------------------------------------------------------------------- |
| id     | Int    | <p>Return Purchase Order ID</p><p>\*Must have either id or number</p>                               |
| number | String | <p>Return Purchase Order Number Require if id = 0 or null</p><p>\*Must have either id or number</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  |

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

| Parameter     | Type   | Description/Example                   |
| ------------- | ------ | ------------------------------------- |
| resCode       | String | <p>Response Code <br>200- Success</p> |
| resDesc       | String | Response Description                  |
| {% endtab %}  |        |                                       |
| {% endtabs %} |        |                                       |

## Void Return Purchase Order Payment

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/ReturnPurchaseOrder/VoidReturnPurchaseOrderPayment`

Delete payment in return purchase order.

#### Query Parameters

| Name   | Type   | Description                                                                                         |
| ------ | ------ | --------------------------------------------------------------------------------------------------- |
| id     | Int    | <p>Return Purchase Order ID</p><p>\*Must have either id or number</p>                               |
| number | String | <p>Return Purchase Order Number Require if id = 0 or null</p><p>\*Must have either id or number</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  |

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

| Parameter     | Type   | Description/Example                   |
| ------------- | ------ | ------------------------------------- |
| resCode       | String | <p>Response Code <br>200- Success</p> |
| resDesc       | String | Response Description                  |
| {% endtab %}  |        |                                       |
| {% endtabs %} |        |                                       |

## Add Return Purchase Order Tag

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/ReturnPurchaseOrder/AddReturnPurchaseOrderTag`

Add tag to return purchase order.

#### Query Parameters

| Name                                  | Type   | Description                                                                                         |
| ------------------------------------- | ------ | --------------------------------------------------------------------------------------------------- |
| id                                    | Int    | <p>Return Purchase Order ID</p><p>\*Must have either id or number</p>                               |
| tag<mark style="color:red;">\*</mark> | String | Tag                                                                                                 |
| number                                | String | <p>Return Purchase Order Number Require if id = 0 or null</p><p>\*Must have either id or number</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  |

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

| Parameter     | Type   | Description/Example                   |
| ------------- | ------ | ------------------------------------- |
| resCode       | String | <p>Response Code <br>200- Success</p> |
| resDesc       | String | Response Description                  |
| {% endtab %}  |        |                                       |
| {% endtabs %} |        |                                       |

## Delete Return Purchase Order Tag

<mark style="color:green;">`POST`</mark> `https://open-api.zortout.com/v4/ReturnPurchaseOrder/DeleteReturnPurchaseOrderTag`

Delete tag of return purchase order.

#### Query Parameters

| Name                                  | Type   | Description                                                                                         |
| ------------------------------------- | ------ | --------------------------------------------------------------------------------------------------- |
| id                                    | Int    | <p>Return Purchase Order ID</p><p>\*Must have either id or number</p>                               |
| tag<mark style="color:red;">\*</mark> | String | Tag                                                                                                 |
| number                                | String | <p>Return Purchase Order Number Require if id = 0 or null</p><p>\*Must have either id or number</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  |

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

| Parameter     | Type   | Description/Example                   |
| ------------- | ------ | ------------------------------------- |
| resCode       | String | <p>Response Code <br>200- Success</p> |
| resDesc       | String | Response Description                  |
| {% 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.zortout.com/api-reference/return-purchase-order.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.
