List Orders
Get a list of orders with filtering by status and user.Authentication Required: YesRoles: admin, manager, cashier
Query Parameters
Number of orders per page
Order statuses to filter: open, in_progress, served, paid, cancelled
Filter by User ID (UUID format)
Response
Order type: dine_in or takeaway
User who created the order
Example
curl -X GET "https://localhost:8080/api/v1/orders?page=1&limit=10&statuses=open&statuses=in_progress" \
-H "Cookie: access_token=YOUR_TOKEN"
{
"message": "Orders retrieved successfully",
"data": {
"orders": [
{
"id": "789e4567-e89b-12d3-a456-426614174000",
"queue_number": "001",
"type": "dine_in",
"status": "open",
"is_paid": false,
"net_total": 65000,
"user_id": "550e8400-e29b-41d4-a716-446655440000",
"items": [
{
"id": "item-001",
"product_id": "123e4567-e89b-12d3-a456-426614174000",
"product_name": "Espresso",
"quantity": 2,
"price_at_sale": 25000,
"subtotal": 50000
}
],
"created_at": "2024-03-03T10:00:00Z"
}
],
"pagination": {
"current_page": 1,
"per_page": 10,
"total_data": 1,
"total_page": 1
}
}
}
Get Order by ID
Retrieve detailed information of a specific order by its ID.Authentication Required: YesRoles: admin, manager, cashier
Path Parameters
Response
Order type: dine_in or takeaway
User who created the order
Gross total before discount
Example
curl -X GET https://localhost:8080/api/v1/orders/789e4567-e89b-12d3-a456-426614174000 \
-H "Cookie: access_token=YOUR_TOKEN"
Create Order
Create a new order with multiple items.Authentication Required: YesRoles: admin, manager, cashier
Request Body
Order type: dine_in or takeaway
Array of order items (minimum 1 item)
Response
Example
curl -X POST https://localhost:8080/api/v1/orders \
-H "Content-Type: application/json" \
-H "Cookie: access_token=YOUR_TOKEN" \
-d '{
"type": "dine_in",
"items": [
{
"product_id": "123e4567-e89b-12d3-a456-426614174000",
"quantity": 2,
"options": [
{
"product_option_id": "323e4567-e89b-12d3-a456-426614174002"
}
]
},
{
"product_id": "223e4567-e89b-12d3-a456-426614174001",
"quantity": 1,
"options": []
}
]
}'
{
"message": "Order created successfully",
"data": {
"id": "889e4567-e89b-12d3-a456-426614174010",
"type": "dine_in",
"status": "open",
"gross_total": 90000,
"discount_amount": 0,
"net_total": 90000,
"items": [
{
"id": "item-001",
"product_id": "123e4567-e89b-12d3-a456-426614174000",
"product_name": "Espresso",
"quantity": 2,
"price_at_sale": 25000,
"subtotal": 60000,
"options": [
{
"product_option_id": "323e4567-e89b-12d3-a456-426614174002",
"option_name": "Extra Shot",
"price_at_sale": 5000
}
]
},
{
"id": "item-002",
"product_id": "223e4567-e89b-12d3-a456-426614174001",
"product_name": "Cappuccino",
"quantity": 1,
"price_at_sale": 30000,
"subtotal": 30000,
"options": []
}
],
"created_at": "2024-03-03T12:30:00Z"
}
}
Update Order Items
Update, add, or remove items in an existing open order.Authentication Required: YesRoles: admin, manager, cashier
Path Parameters
Request Body
Array of order items (same structure as Create Order items)
Response
Example
curl -X PUT https://localhost:8080/api/v1/orders/889e4567-e89b-12d3-a456-426614174010/items \
-H "Content-Type: application/json" \
-H "Cookie: access_token=YOUR_TOKEN" \
-d '[
{
"product_id": "123e4567-e89b-12d3-a456-426614174000",
"quantity": 3,
"options": []
}
]'
Update Order Status
Update the operational status of an existing order.Authentication Required: YesRoles: admin, manager, cashier
Path Parameters
Request Body
New status: in_progress, served, or paid
Response
Example
curl -X POST https://localhost:8080/api/v1/orders/889e4567-e89b-12d3-a456-426614174010/update-status \
-H "Content-Type: application/json" \
-H "Cookie: access_token=YOUR_TOKEN" \
-d '{
"status": "in_progress"
}'
Apply a specific promotion to an existing order.Authentication Required: YesRoles: admin, manager, cashier
Path Parameters
Request Body
Response
Updated order details with discount applied
Example
curl -X POST https://localhost:8080/api/v1/orders/889e4567-e89b-12d3-a456-426614174010/apply-promotion \
-H "Content-Type: application/json" \
-H "Cookie: access_token=YOUR_TOKEN" \
-d '{
"promotion_id": "999e4567-e89b-12d3-a456-426614174020"
}'
Confirm Manual Payment
Process a manual payment (Cash) and finalize an order.Authentication Required: YesRoles: admin, manager, cashier
Path Parameters
Request Body
Cash received amount (minimum 0, required for cash payments)
Response
Completed order details with payment information
Example
curl -X POST https://localhost:8080/api/v1/orders/889e4567-e89b-12d3-a456-426614174010/pay/manual \
-H "Content-Type: application/json" \
-H "Cookie: access_token=YOUR_TOKEN" \
-d '{
"payment_method_id": 1,
"cash_received": 100000
}'
{
"message": "Payment completed successfully",
"data": {
"id": "889e4567-e89b-12d3-a456-426614174010",
"status": "paid",
"net_total": 90000,
"payment_method_id": 1,
"cash_received": 100000,
"change_due": 10000
}
}
Initiate Midtrans Payment
Create a QRIS/Gopay payment session via Midtrans for an existing order.Authentication Required: YesRoles: admin, manager, cashier
Path Parameters
Response
Example
curl -X POST https://localhost:8080/api/v1/orders/889e4567-e89b-12d3-a456-426614174010/pay/midtrans \
-H "Cookie: access_token=YOUR_TOKEN"
Cancel Order
Cancel an existing order with a reason.Authentication Required: YesRoles: admin, manager, cashier
Path Parameters
Request Body
Additional notes (max 255 characters)
Response
Example
curl -X POST https://localhost:8080/api/v1/orders/889e4567-e89b-12d3-a456-426614174010/cancel \
-H "Content-Type: application/json" \
-H "Cookie: access_token=YOUR_TOKEN" \
-d '{
"cancellation_reason_id": 1,
"cancellation_notes": "Customer changed their mind"
}'
{
"message": "Order cancelled successfully"
}