Skip to main content

Update Sales Order

1. API Information

  • Endpoint: /api/v6.1/sale_order
  • Method: PUT
  • Authentication: Requires X-API-KEY
  • Header:
    • Content-Type: application/json
    • X-API-KEY: <your_api_key>

2. Request Body

{
"account": {
"account_name": "Customer ABC",
"contact_name": "Contact Person XYZ",
"account_phone": "0900000000",
"account_email": "[email protected]",
"account_address": "Customer Address"
},
"current_order_code": "ORDER_001",
"order_date": "2025-02-05",
"assigned_username": "employee01",
"order_source_name": "Sales Source A",
"store_name": "Central Warehouse",
"lading_code": "LD_001",
"campaign_code": "CMP_001",
"opportunity_code": "OPP_001",
"saved_order_details": [
{
"product_code": "PROD_001",
"product_name": "Product A",
"unit_name": "Piece",
"quantity": 1,
"price": 65000,
"product_sale_off": 1,
"cash_discount": 10000,
"note": "Fragile product"
}
],
"order_terms": [
{"term_content": "1. Allow co-inspection"},
{"term_content": "2. No returns allowed"}
],
"discount": 10,
"discount_amount": 11000,
"vat": 10,
"vat_amount": 4400,
"transport_amount": 10000,
"installation_amount": 10000,
"saved_sale_order_payments": [
{
"method_name": "Bank Transfer",
"amount": 50000,
"description": "Advance payment 50k",
"pay_date": "2025-02-03"
}
]
}

3. Field Descriptions

3.1. Customer Information (account)

| Field | Type | Description |
|-------------------|--------|------|
| account_name | string | Customer name |
| contact_name | string | Contact person |
| account_phone | string | Customer phone number |
| account_email | string | Customer email |
| account_address| string | Customer address |\

3.2. Order Information

| Field | Type | Description |
|----------------------|--------|------|
| current_order_code | string | Order code to update |
| order_date | string | Order date (YYYY-MM-DD) |
| assigned_username | string | Assigned employee |
| order_source_name | string | Order source |
| store_name | string | Export warehouse name |
| lading_code | string | Bill of lading code |
| campaign_code | string | Campaign code |
| opportunity_code | string | Opportunity code |\

3.3. Product Details (saved_order_details)

| Field | Type | Description |
|--------------------|--------|------|
| product_code | string | Product code |
| product_name | string | Product name |
| unit_name | string | Unit of measurement |
| quantity | int | Quantity |
| price | int | Product price |
| product_sale_off| int | Product discount (0: no discount, 1: discounted) |
| cash_discount | int | Discount amount |
| note | string | Product note |\

3.4. Order Terms (order_terms)

| Field | Type | Description |
|---------------|--------|------|
| term_content| string | Term content |\

3.5. Payment

| Field | Type | Description |
|-----------------------|--------|------|
| discount | int | Discount percentage |
| discount_amount | int | Discount amount |
| vat | int | Tax percentage |
| vat_amount | int | Tax amount |
| transport_amount | int | Shipping fee |
| installation_amount| int | Installation fee |
| saved_sale_order_payments| array | List of direct payments |\

4. Response

{
"message": "Successfully updated",
"data": {
"order_id": 96,
"order_code": "ORDER_001"
}
}

5. Notes

  • current_order_code is the order code to update.\
  • Some fields like lading_code, campaign_code can be left empty if not applicable.\
  • order_terms helps set specific terms for the order.\
  • saved_sale_order_payments will automatically pay for the order when the order is created.\