Sales
PATCH
Update Sale
Update an existing sale.
Required Permission:
Edit Sale
PATCH
/sales/{id}
Request Body
JSONRequest Parameters
| Parameter | Type | Required | Validation | Description |
|---|---|---|---|---|
| customer_id | Integer | Optional | integer, optional | The customer id |
| waiter_id | Integer | Optional | integer, optional | The waiter id |
| date | Date | Optional | date, optional (Y-m-d) | The sale date |
| time | Time | Optional | time, optional (H:i:s) | The sale time |
| token_no | String | Optional | string, optional | The token number |
| take_away_type | String | Optional | string, optional | The take away type |
| order_type | String | Optional | string, optional | The order type (e.g., Dine In, Takeaway) |
| total_quantity | Decimal | Optional | decimal, optional | The total quantity sold |
| total_amount | Decimal | Optional | decimal, optional | The total amount before discounts/VAT |
| discount_percent | Decimal | Optional | decimal, optional | The discount percent |
| discount_amount | Decimal | Optional | decimal, optional | The discount amount |
| vat_percent | Decimal | Optional | decimal, optional | The VAT percent |
| vat_amount | Decimal | Optional | decimal, optional | The VAT amount |
| note | String | Optional | string, optional | Additional notes |
| items | Array | Required | array, required | The sale items (will replace existing items) |
| items.*.product_id | Integer | Required | integer, required, exists:products | The product ID (must be active) |
| items.*.product_variant_id | Integer | Conditional | integer, nullable, exists:product_variants | Required if the product has variants, otherwise must be null |
| items.*.quantity | Decimal | Required | numeric, required, min:0.01 | The quantity to sell |
| items.*.unit_price | Decimal | Required | numeric, required, min:0.01 | The unit price of the item |
| items.*.note | String | Optional | string, nullable | Additional note for the item |
| items.*.addons | Array | Optional | array, nullable | The addons for this item |
| items.*.addons.*.addon_id | Integer | Required* | integer, required_with:items.*.addons, exists:addons | The addon ID (must be active & valid for product) |
| items.*.addons.*.quantity | Decimal | Required* | numeric, required_with:items.*.addons, min:0.01 | The addon quantity |
| items.*.addons.*.unit_price | Decimal | Required* | numeric, required_with:items.*.addons, min:0.01 | The unit price of the addon |
| items.*.addons.*.note | String | Optional | string, nullable | Note for the addon |
| items.*.flavors | Array | Optional | array, optional | The sale item flavors (will replace existing sale item flavors) |
| items.*.flavors.*.flavor_id | Integer | Required* | integer, required_with:items.*.flavors, exists:flavors | The flavor ID (must be active & valid for product) |
| items.*.flavors.*.quantity | Decimal | Required* | numeric, required_with:items.*.flavors, min:0.01 | The flavor quantity |
| payments | Array | Optional | array, optional | The sale payments (will replace existing payments) |
| payments.*.fund_id | Integer | Required* | integer, required_with:payments, exists:funds | The fund/payment method ID (must be active) |
| payments.*.amount | Decimal | Required* | numeric, required_with:payments, min:0.01 | The payment amount |
| payments.*.payment_reference | String | Optional | string, nullable | Payment reference (e.g., transaction ID) |
| service_charges | Array | Optional | array, optional | The service charges (will replace existing service charges) |
| service_charges.*.name | String | Required* | string, required_with:service_charges | The service charge name |
| service_charges.*.amount | Decimal | Required* | numeric, required_with:service_charges, min:0.01 | The service charge amount |
| service_charges.*.note | String | Optional | string, optional | The service charge note |
Payment Calculation Logic
The system automatically calculates the actual paid amount and change amount for each payment:
- Actual Paid Amount: Capped at the remaining due amount (cannot exceed final amount)
- Change Amount: Any excess payment is recorded as change to be returned to customer
- Only the actual paid amount (excluding change) is added to total_paid_amount
Payment Status: Automatically set to Paid (due ≤ 0), Partial (some payment made), or Due (no payment)
Response
200 OKStatus Code
HTTP status code (200)
Message
Human-readable description
Data
Updated sale details