Skip to main content

List Orders

Get a list of orders with filtering by status and user.Authentication Required: YesRoles: admin, manager, cashier

Query Parameters

page
integer
Page number
limit
integer
Number of orders per page
statuses
array
Order statuses to filter: open, in_progress, served, paid, cancelled
user_id
string
Filter by User ID (UUID format)

Response

message
string
Success message
data
object
orders
array
id
string
Order ID (UUID)
queue_number
string
Queue/order number
type
string
Order type: dine_in or takeaway
status
string
Order status
is_paid
boolean
Payment status
net_total
integer
Total amount
user_id
string
User who created the order
items
array
Order items
created_at
string
Creation timestamp
pagination
object
Pagination information

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

id
string
required
Order ID (UUID format)

Response

message
string
Success message
data
object
id
string
Order ID
type
string
Order type: dine_in or takeaway
status
string
Order status
user_id
string
User who created the order
gross_total
integer
Gross total before discount
discount_amount
integer
Discount amount
net_total
integer
Net total after discount
applied_promotion_id
string
Applied promotion ID
payment_method_id
integer
Payment method ID
cash_received
integer
Cash received amount
change_due
integer
Change to return
items
array
Order items with details
created_at
string
Creation timestamp
updated_at
string
Last update timestamp

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

type
string
required
Order type: dine_in or takeaway
items
array
required
Array of order items (minimum 1 item)
product_id
string
required
Product ID (UUID)
quantity
integer
required
Quantity
options
array
Product options/variants
product_option_id
string
required
Product option ID

Response

message
string
Success message
data
object
Created order details

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

id
string
required
Order ID (UUID format)

Request Body

Array of order items (same structure as Create Order items)

Response

message
string
Success message
data
object
Updated order details

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

id
string
required
Order ID (UUID format)

Request Body

status
string
required
New status: in_progress, served, or paid

Response

message
string
Success message
data
object
Updated order details

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 Promotion

Apply a specific promotion to an existing order.Authentication Required: YesRoles: admin, manager, cashier

Path Parameters

id
string
required
Order ID (UUID format)

Request Body

promotion_id
string
required
Promotion ID (UUID)

Response

message
string
Success message
data
object
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

id
string
required
Order ID (UUID format)

Request Body

payment_method_id
integer
required
Payment method ID
cash_received
integer
Cash received amount (minimum 0, required for cash payments)

Response

message
string
Success message
data
object
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

id
string
required
Order ID (UUID format)

Response

message
string
Success message
data
object
order_id
string
Order ID
transaction_id
string
Midtrans transaction ID
gross_amount
string
Transaction amount
qr_string
string
QRIS code string
expiry_time
string
Payment expiration time
actions
array
Payment action URLs

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

id
string
required
Order ID (UUID format)

Request Body

cancellation_reason_id
integer
required
Cancellation reason ID
cancellation_notes
string
Additional notes (max 255 characters)

Response

message
string
Success message

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"
}

Build docs developers (and LLMs) love