Purchases
POST
Create Purchases
Create a new purchase.
Required Permission:
Create Purchase
POST
/purchases
Request Body
JSONRequest Parameters
| Parameter | Type | Required | Validation | Description |
|---|---|---|---|---|
| invoice_no | String | Optional | string, optional | The Supplier invoice number |
| supplier_id | Integer | Required | integer, required | The supplier id |
| date | Date | Optional | date, optional | The date |
| total_quantity | Decimal | Optional | decimal, optional | The total quantity |
| total_amount | Decimal | Optional | decimal, optional | The total amount |
| 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 | The note |
| service_charge_name | String | Optional | string, optional | The service charge name |
| service_charge_amount | Decimal | Optional | decimal, optional | The service charge amount |
| items | Array | Required | array, required | The items (each must have exactly one of product_id OR ingredient_id OR asset_id) |
| items.*.product_id | Integer | Conditional | integer, required without ingredient_id & asset_id | The product id (required if ingredient_id and asset_id are not provided) |
| items.*.product_variant_id | Integer | Optional | integer, optional | The product variant id (only for products with variants) |
| items.*.ingredient_id | Integer | Conditional | integer, required without product_id & asset_id | The ingredient id (required if product_id and asset_id are not provided) |
| items.*.asset_id | Integer | Conditional | integer, required without product_id & ingredient_id | The asset id (required if product_id and ingredient_id are not provided) |
| items.*.quantity | Decimal | Required | decimal, min: 0.01 | The quantity |
| items.*.unit_price | Decimal | Required | decimal, min: 0.01 | The unit price |
| payments | Array | Optional | array, optional | The payments array |
| payments.*.fund_id | Integer | Required with payments | integer, exists in active funds | The fund id for the payment |
| payments.*.amount | Decimal | Required with payments | decimal, min: 0.01 | The payment amount |
| payments.*.payment_reference | String | Optional | string, nullable | The payment reference (e.g., transaction ID, check number) |
Response
201 CreatedStatus Code
HTTP status code (201)
Message
Human-readable description
Data
Created purchase details