Data Model ER Diagram
Part of: MPAC SmartPOS Cloud Platform - Product RequirementsVersion: 2.0 Last Updated: 2026-01-28
Overview
This document provides a simplified entity-relationship diagram showing the core data model of the MPAC SmartPOS Cloud Platform. It illustrates the hierarchical relationships between organizations, devices, transactions, and supporting entities.
Simplified ER Diagram
PSP (id, code, name)
└──1:N── Merchant (id, psp_id, code, name)
└──1:N── Store (id, merchant_id, code, name)
├──1:N── Device (device_id, store_id, serial_number, status)
├──1:N── Order (id, store_id, order_number, items[], status)
│ └──1:1── Bill (id, order_id, bill_number, total, status)
│ └──1:N── Payment (id, bill_id, amount, status)
│ ├──1:1── Receipt (id, payment_id, delivery_method)
│ └──0:1── CardSlip (id, payment_id, slip_number)
├──1:N── Customer (id, merchant_id, customer_number, name)
├──1:N── Settlement (id, store_id, date, totals, status)
└──1:N── StoreProviderConfig (id, store_id, provider, credentials)
User (id, email, role, merchant_id, store_id)
JWTKey (id, key_type, public_key, private_key)
AuthenticationLog (id, user_id, event_type, timestamp)
PaymentIntent (id, merchant_id, store_id, amount, status)
└──1:N── PaymentTransaction (id, payment_intent_id, provider_transaction_id)Key Relationships
Organizational Hierarchy
- PSP → Merchant → Store: Three-level tenant hierarchy
- Each level can have multiple child entities
- Store is the operational unit where devices and transactions occur
Device Management
- Store → Device: One-to-many relationship
- Each device belongs to exactly one store
- Devices authenticate using OAuth2 with device-specific credentials
Transaction Flow
- Order → Bill → Payment: Sequential relationship
- One order generates one bill
- One bill can have multiple payments (split payments)
- Each payment generates one receipt
Customer Data
- Merchant → Customer: Customer data belongs to merchant level
- Customers can make purchases across multiple stores within same merchant
Payment Gateway
- PaymentIntent → PaymentTransaction: Track external payment processing
- One intent can have multiple transactions (retries, multi-provider)
- Links to Payment entity in svc-smarttab
See Also
Related References:
- Glossary - Entity definitions
- API Endpoint Summary - CRUD operations
- Status Code Reference - Entity status values
Technical Documentation:
- Database Architecture - Complete schema details
- Multi-tenancy Model - Tenant isolation strategy
- Data Migration Strategy - Schema evolution
Domain Documentation:
- Merchant & Store Management - Organizational entities
- Orders & Bills - Transaction entities
- Payment Processing - Payment entities
Navigation: ↑ Back to Index | ← API Reference | Next: Status Codes →