GolfManager Logo V3 API
Version 2025-07-21

Billing Overview

The billing module provides a comprehensive system for managing sales, payments, products, and taxes. It serves as the core financial engine for transactions within the platform.

Core Concepts

Sales: The main transactional entity representing a purchase. Sales contain one or more products, applicable taxes, discounts, and pricing information. Sales progress through different statuses from draft to paid or canceled.

Products: Items or services that can be sold. Products can be organized into families and subfamilies for categorization. Each product can have associated taxes and tags.

Payments: Records of money transactions. A single sale can be paid using multiple payment methods (split payments). Payments can be refunded if needed.

Payment Methods: Various ways to receive payment including cash, card, bank transfer, direct debit, online gateways, deposits, and vouchers.

Main Database Tables

Core Sales Flow

    Customer
        β”‚
        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Sale    │────▢│   Product   │────▢│  Subfamily  β”‚
β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚                                       β”‚
      β”‚                                       β–Ό
      β”‚                                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚                                 β”‚   Family    β”‚
      β”‚                                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚
      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ SalePayment │◄──▢│   Payment   │───▢│PaymentMethodβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Product Organization

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Family    β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚ 1:n
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Subfamily  β”‚ (optional, nullable)
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚ 1:n
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Product   │◄──▢│ ProductToTag  │◄──▢│ ProductTag  β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β”‚ n:m
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ProductToTax  │◄──▢│     Tax     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tax Application

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Product   │◄──▢│ ProductToTax  │◄──▢│     Tax     β”‚    (default taxes)
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚                                       β”‚
       β”‚                                       β”‚ (copied when sale created)
       β–Ό                                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Sale     │───▢│   SaleTax   │◄──▢│     Tax     β”‚    (actual applied taxes)
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Customer   β”‚ (tax exempt?)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Entities

Product Organization

Tax System

Supporting Tables

Sale Lifecycle

  1. Draft (0): Sale is being created/edited
  2. No Cost (1): Sale has no cost (free items)
  3. Pending (2): Sale awaits payment
  4. Paid (3): Sale is fully paid
  5. Canceled (4): Original sale marked as canceled (historical record preserved)
  6. Cancelation (5): Compensating sale with negative amounts to zero out the original sale

Important: When canceling a sale, the system preserves the original sale (status β†’ Canceled) and creates a new compensating sale (status = Cancelation) with opposite amounts. This maintains accurate historical records while ensuring totals balance to zero.

Cancellation Process

Original Sale (ID: 1001)          After Cancellation:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Status: PAID        β”‚           β”‚ Status: CANCELED    β”‚
β”‚ Amount: €100        β”‚    ──▢    β”‚ Amount: €100        β”‚ (preserved)
β”‚ Tax: €21            β”‚           β”‚ Tax: €21            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                           +
                                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                  β”‚ Status: CANCELATION β”‚
                                  β”‚ Amount: -€100       β”‚ (new compensating sale)
                                  β”‚ Tax: -€21           β”‚
                                  β”‚ Parent: 1001        β”‚
                                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  
                                  Total Impact: €0

Key Features

Multi-Payment Support: Sales can be paid using multiple payment methods simultaneously.

Tax Management: Flexible tax system supporting multiple taxes per product, tax-exempt customers, and automatic tax calculations.

Split Sales: Large sales can be split into smaller transactions or by payment amounts.

Hierarchical Sales: Support for parent-child sale relationships with cascading operations.

Online Payments: Integration with payment gateways for web-based transactions via payment links.

Refunds: Full support for payment refunds and sale cancellations.

Automation: Automatic sale timeout and cancellation via scheduled jobs.

Business Rules

API Integration

The billing module exposes RESTful APIs for: - Creating and updating sales - Processing payments - Managing refunds and cancellations - Generating payment links for online checkout - Retrieving customer transaction history

This system provides the foundation for any business requiring robust transaction processing with flexible payment options and comprehensive financial reporting capabilities.

↑