Skip to main content

POS Money Movement API

The POS Money Movement API provides endpoints for managing cash movements (deposits and withdrawals) within active POS sessions (openings). Money movements track all cash in/out operations during a POS session.
All POS Money Movement API endpoints require authentication and a valid x-store-id header to identify the store context.

Overview

Each money movement:
  • Belongs to one POS opening (session)
  • Has an amount and type (deposit or withdrawal)
  • Can include an optional note
  • Is timestamped for audit purposes
  • Can only be created for active (open) POS sessions

Endpoint Details

Base URL: /pos-money-movements
Content-Type: application/json

Required Headers

Authorization: Bearer <token>
x-store-id: <store_id>
All routes require a valid x-store-id header. Money movements can only be created for active (open) POS sessions.

Entity: POS Money Movement

FieldTypeDescription
idstringUnique movement ID
amountnumberAmount of money moved
type"deposit" | "withdrawal"Type of movement (cash in or cash out)
posOpeningIdstringAssociated POS opening (session) identifier
notestringOptional comment or reason for the movement
createdAtDateCreation timestamp
updatedAtDateLast update timestamp

Create Money Movement

POST /pos-money-movements Registers a new cash movement (deposit or withdrawal) inside an active POS session (opening). Requires Authentication: Bearer token in Authorization header

Required Headers

KeyValueRequiredDescription
x-store-idstringYesThe store ID where the movement is created

Request Body

{
  "amount": 2500,
  "type": "deposit",
  "openingId": "pos_opening_id_here",
  "note": "Cash added to drawer"
}
FieldTypeRequiredDescription
amountnumberYesAmount of money moved
type"deposit" | "withdrawal"YesDefines whether money was added or withdrawn
openingIdstringYesThe POS opening ID this movement belongs to
notestringNoOptional comment or reason

Success Response

Status Code: 200 OK
{
  "success": true,
  "data": {
    "id": "money_movement_id",
    "amount": 2500,
    "type": "deposit",
    "posOpeningId": "pos_opening_id_here",
    "note": "Cash added to drawer",
    "createdAt": "2025-11-03T10:30:00.000Z",
    "updatedAt": "2025-11-03T10:30:00.000Z"
  }
}

Possible Errors

CodeMessage
404POS opening with ID not found
400Opening ID missing or invalid
500POS opening is already closed and cannot accept new movements

Example Request

curl -X POST "https://jethings-backend.fly.dev/pos-money-movements" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "x-store-id: store_id_here" \
  -d '{
    "amount": 2500,
    "type": "deposit",
    "openingId": "pos_opening_id_here",
    "note": "Cash added to drawer"
  }'

Get Money Movements by POS Opening

GET /pos-money-movements/:openingId Fetches all money movements linked to a specific POS opening and provides a summary with totals (cash in/out/net). Requires Authentication: Bearer token in Authorization header

Required Headers

KeyValueRequiredDescription
x-store-idstringYesThe store ID where the opening is located

Path Parameters

ParameterTypeRequiredDescription
openingIdstringYesThe ID of the POS opening (session)

Success Response

Status Code: 200 OK
{
  "success": true,
  "data": {
    "movements": [
      {
        "id": "mm_1",
        "amount": 2500,
        "type": "deposit",
        "posOpeningId": "pos_opening_id_here",
        "note": "Initial cash",
        "createdAt": "2025-11-03T09:30:00.000Z",
        "updatedAt": "2025-11-03T09:30:00.000Z"
      },
      {
        "id": "mm_2",
        "amount": 500,
        "type": "withdrawal",
        "posOpeningId": "pos_opening_id_here",
        "note": "Paid for delivery",
        "createdAt": "2025-11-03T10:00:00.000Z",
        "updatedAt": "2025-11-03T10:00:00.000Z"
      }
    ],
    "summary": {
      "totalMovements": 2,
      "totalIn": 2500,
      "totalOut": 500,
      "netAmount": 2000
    }
  }
}

Response Fields

Movements Array

FieldTypeDescription
idstringUnique movement ID
amountnumberAmount of money moved
type"deposit" | "withdrawal"Type of movement
posOpeningIdstringAssociated POS opening identifier
notestringOptional comment or reason
createdAtstringCreation timestamp (ISO 8601)
updatedAtstringLast update timestamp (ISO 8601)

Summary Object

FieldTypeDescription
totalMovementsnumberTotal number of movements for this opening
totalInnumberSum of all deposit amounts
totalOutnumberSum of all withdrawal amounts
netAmountnumberNet amount (totalIn - totalOut)

Possible Errors

CodeMessage
404POS opening with ID not found
500Failed to fetch money movements

Example Request

curl -X GET "https://jethings-backend.fly.dev/pos-money-movements/pos_opening_id_here" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "x-store-id: store_id_here"

Summary

EndpointMethodDescription
/pos-money-movementsPOSTCreate a new deposit or withdrawal
/pos-money-movements/:openingIdGETList all movements for a POS opening with summary

Security & Validation

  • All routes require a valid x-store-id header
  • Money movements can only be created for active (open) POS sessions
  • POS opening must exist and be validated before creating movements
  • Closed POS sessions cannot accept new money movements
  • Store ID validation prevents unauthorized access

Business Logic

Money Movement Creation

  • POS opening must exist and be active (not closed)
  • Amount must be a positive number
  • Type must be either “deposit” or “withdrawal”
  • Movements are automatically timestamped
  • Note field is optional

Movement Retrieval

  • Returns all movements for a specific POS opening
  • Movements are ordered by creation date (oldest first)
  • Summary automatically calculates:
    • Total number of movements
    • Total deposits (cash in)
    • Total withdrawals (cash out)
    • Net amount (deposits - withdrawals)

Validation Rules

  • Cannot create movements for non-existent POS openings
  • Cannot create movements for closed POS sessions
  • All movements are permanently recorded for audit purposes

Error Responses

Common Error Codes

CodeDescription
400Bad Request - Invalid input or validation
404Not Found - POS opening doesn’t exist
500Internal Server Error - Database or server error

Error Response Format

{
  "message": "Error description",
  "statusCode": 404
}