Skip to main content

Overview

Transactions in POS Kasir are managed through two main systems:
  1. Order Transactions - Handled via the Orders API (see Orders documentation)
  2. Cash Transactions - Cash-in and cash-out operations during shifts
This page documents the cash transaction endpoints for managing money flow during shifts.

Create Cash Transaction

Create a cash in/out transaction during an active shift.Authentication Required: YesRoles: admin, manager, cashier

Request Body

type
string
required
Transaction type: cash_in or cash_out
amount
integer
required
Transaction amount (minimum 1)
category
string
required
Transaction category (e.g., “expense”, “drop”, “refund”)
description
string
Transaction description/notes

Response

message
string
Success message
data
object
id
string
Transaction ID (UUID)
shift_id
string
Associated shift ID
type
string
Transaction type
amount
integer
Transaction amount
category
string
Transaction category
description
string
Transaction description
user_id
string
User who created the transaction
created_at
string
Creation timestamp

Example - Cash Out (Expense)

curl -X POST https://localhost:8080/api/v1/shifts/cash-transaction \
  -H "Content-Type: application/json" \
  -H "Cookie: access_token=YOUR_TOKEN" \
  -d '{
    "type": "cash_out",
    "amount": 50000,
    "category": "expense",
    "description": "Office supplies purchase"
  }'
{
  "message": "Cash transaction created successfully",
  "data": {
    "id": "111e4567-e89b-12d3-a456-426614174100",
    "shift_id": "222e4567-e89b-12d3-a456-426614174200",
    "type": "cash_out",
    "amount": 50000,
    "category": "expense",
    "description": "Office supplies purchase",
    "user_id": "550e8400-e29b-41d4-a716-446655440000",
    "created_at": "2024-03-03T14:30:00Z"
  }
}

Example - Cash In (Drop)

curl -X POST https://localhost:8080/api/v1/shifts/cash-transaction \
  -H "Content-Type: application/json" \
  -H "Cookie: access_token=YOUR_TOKEN" \
  -d '{
    "type": "cash_in",
    "amount": 200000,
    "category": "drop",
    "description": "Cash drop to safe"
  }'

Start Shift

Start a new shift with opening cash balance.Authentication Required: YesRoles: admin, manager, cashier

Request Body

start_cash
integer
required
Starting cash amount (minimum 0)
password
string
required
User password for verification

Response

message
string
Success message
data
object
id
string
Shift ID
user_id
string
User ID
start_cash
integer
Starting cash amount
status
string
Shift status: open
start_time
string
Shift start timestamp

Example

curl -X POST https://localhost:8080/api/v1/shifts/start \
  -H "Content-Type: application/json" \
  -H "Cookie: access_token=YOUR_TOKEN" \
  -d '{
    "start_cash": 500000,
    "password": "userpassword123"
  }'
{
  "message": "Shift started successfully",
  "data": {
    "id": "222e4567-e89b-12d3-a456-426614174200",
    "user_id": "550e8400-e29b-41d4-a716-446655440000",
    "start_cash": 500000,
    "status": "open",
    "start_time": "2024-03-03T08:00:00Z"
  }
}

End Shift

End the current shift and record closing cash balance.Authentication Required: YesRoles: admin, manager, cashier

Request Body

password
string
required
User password for verification
actual_cash_end
integer
Actual cash counted at shift end (minimum 0)

Response

message
string
Success message
data
object
id
string
Shift ID
user_id
string
User ID
start_cash
integer
Starting cash amount
expected_cash_end
integer
Expected ending cash (calculated)
actual_cash_end
integer
Actual ending cash (counted)
difference
integer
Difference (actual - expected)
status
string
Shift status: closed
start_time
string
Shift start timestamp
end_time
string
Shift end timestamp

Example

curl -X POST https://localhost:8080/api/v1/shifts/end \
  -H "Content-Type: application/json" \
  -H "Cookie: access_token=YOUR_TOKEN" \
  -d '{
    "password": "userpassword123",
    "actual_cash_end": 1450000
  }'
{
  "message": "Shift ended successfully",
  "data": {
    "id": "222e4567-e89b-12d3-a456-426614174200",
    "user_id": "550e8400-e29b-41d4-a716-446655440000",
    "start_cash": 500000,
    "expected_cash_end": 1475000,
    "actual_cash_end": 1450000,
    "difference": -25000,
    "status": "closed",
    "start_time": "2024-03-03T08:00:00Z",
    "end_time": "2024-03-03T18:00:00Z"
  }
}

Get Active Shift

Get information about the currently active shift for the authenticated user.Authentication Required: YesRoles: admin, manager, cashier

Response

message
string
Success message
data
object
Active shift information (null if no active shift)

Example

curl -X GET https://localhost:8080/api/v1/shifts/active \
  -H "Cookie: access_token=YOUR_TOKEN"
{
  "message": "Active shift retrieved successfully",
  "data": {
    "id": "222e4567-e89b-12d3-a456-426614174200",
    "user_id": "550e8400-e29b-41d4-a716-446655440000",
    "start_cash": 500000,
    "status": "open",
    "start_time": "2024-03-03T08:00:00Z"
  }
}

Transaction Types

Cash Out Types

  • expense - General business expenses (supplies, utilities, etc.)
  • drop - Cash removed from register for safekeeping
  • refund - Customer refund
  • other - Other cash outflows

Cash In Types

  • opening - Opening cash balance
  • deposit - Cash added to register
  • other - Other cash inflows

Order Payment Transactions

For order payment transactions, please refer to the Orders API documentation. Order payments are automatically tracked and included in shift calculations.
  • POST /api/v1/orders/{id}/pay/manual - Process cash/card payment
  • POST /api/v1/orders/{id}/pay/midtrans - Process QRIS/e-wallet payment
  • GET /api/v1/payment-methods - Get available payment methods

Build docs developers (and LLMs) love