Skip to content

Checkout & POS

Point-of-sale checkout, invoicing, payments, deposits, refunds, and tip handling.

9 min read

Overview

Checkout is the point where an appointment (or a walk-in sale) becomes a paid invoice. The POS screen (/dashboard/billing/checkout) pre-populates the cart with the services from the appointment. Retail items, add-ons, and adjustments can be added before payment is captured. Invoice statuses are draft, paid and void.

Who may finalise a bill is controlled by the billing.create role toggle (Settings, Roles and Permissions). By default only org_owner, brand_manager and location_manager have it; owners can switch it on for front_desk or stylist. A solo stylist may also bill their own in-progress appointment.

Checkout Flow

  1. Initiate — From an appointment, or as a walk-in, guest walk-in, or membership sale (checkoutType)
  2. Review cart — Pre-populated from appointment services; add retail products, remove or adjust items
  3. Apply discounts — Discount code, loyalty points, spin-wheel prize, club/membership discount, manual discount
  4. Capture tip — Optional tip amount for one staff member
  5. Choose payment — One tender or a split across several (see Payment Methods)
  6. Confirm — The total is rounded to the whole rupee, the invoice and payment rows are created, stock is decremented, and the appointment is marked completed

Bill drafts are kept in the browser's localStorage and autosaved.

Invoice Structure

Line item type Description
Service Each service from the appointment at its price (variant + add-ons)
Retail product Physical products sold at checkout
Discount Per-line discount plus an invoice-level discount (code, loyalty, membership, manual)
Tax GST computed per line (tax_rate_pct, hsn_sac), stored as CGST+SGST (intra-state) or IGST (inter-state)
Round off The payable total is rounded half-up to the nearest whole rupee; the difference is stored as round_off_minor

The tip is not an invoice line. It is saved separately in staff_tips (see Tips).

Payment Methods

Payment methods recorded on an invoice (PaymentMethod in lib/billing/types.ts): cash, card, upi, wallet, loyalty_points, complimentary, package, membership, gift_card, combo, other, cashback.

Method Notes
Cash / Card / UPI Recorded at the counter. Online card payment goes through a Razorpay order; the capture webhook then rewrites the splits to a single card row (migration 0275)
Wallet (prepaid) Capped to the service share of the bill (SALO-739); cannot be combined with a package or membership redemption on the same invoice
Cashback / loyalty points Stored-value tenders, allowed on service bills and package sales only
Gift card Validated at checkout (active, not expired, balance above zero) and decremented
Complimentary Zero-payment tender, service and package sales only. A fully complimentary bill writes no split rows
Package / membership / combo Redeems a prepaid session instead of taking money; service bills only
Split payment Several methods on one invoice (see Split Payments)

Per-item allowed_tenders (products, membership plans, packages, combos) restrict which of cash/card/upi/wallet/other may pay for that item. Defaults: membership sale is cash/card/upi only; packages and combos exclude wallet. The server re-checks this in createInvoiceAction (lib/billing/tender-eligibility.ts).

Online payment providers are Razorpay and Stripe (lib/payments/providers). Online booking deposits can use either; staff-invoice card payment uses Razorpay.

Discounts and Overrides

Type Applied by
Discount code Entered at checkout; validated server-side by lib/discount-codes
Loyalty points Points redeemed as a tender (loyalty_points)
Membership (club) discount Service and product percentages from the client's active plan are pre-applied as line discounts in the POS
Spin-wheel prize An unredeemed discount_pct or free_addon prize can be applied to the bill
Manual discount Per-line or invoice-level amount typed at the POS
Complimentary A tender that covers the bill with no payment; no reason code is stored (unverified in UI)

Price lists (/dashboard/price-lists) can be created and edited, but nothing in the checkout or booking code reads them yet, so they do not change prices at checkout.

Deposits

Booking deposits are rows in booking_deposits (/dashboard/deposits), not a checkout line item. Nothing in lib/billing reads them, so a collected deposit is not deducted from the invoice automatically; staff handle the balance at the till.

  • Amount rule (lib/booking/deposit-amount.ts): a service with deposit_required uses its own deposit_type (fixed amount or percent of price); otherwise the brand default applies when require_deposit is on (deposit_pct). Zero means no deposit.
  • Statuses: pending, paid, refunded, forfeited, failed.
  • Allowed transitions (updateDepositStatus): paid from pending; refunded from paid; forfeited from pending or paid; failed from pending. Nothing moves back to pending.
  • Online booking: the public booking flow creates the deposit and pays it through Razorpay or Stripe. The payment webhook marks it paid; a Razorpay refund.processed webhook marks it refunded.
  • Forfeiting is manual: staff click Forfeit in the deposits panel (a confirm dialog warns it cannot be undone). There is no automatic no-show or late-cancel forfeiture rule in code.
  • Refunding is record-only for manual deposits: the panel says to return the money separately.

Tips

At checkout the tip is entered as an amount for one staff member (tipMinor, tipStaffId). It is written to staff_tips (with the dominant tender as payment_method) and is not part of the invoice total. Voiding the invoice deletes the appointment's staff_tips rows.

Splitting a tip among several staff is a separate, manual record: /dashboard/tip-distribution writes tip_distributions plus tip_distribution_lines, with split_method of equal, manual or by_service.

Voiding an invoice

voidInvoiceAction flips the invoice to void and reverses every money movement (gift card, package, membership, wallet balances) in one database transaction (void_invoice_reversals, migration 0196). It then reverses redeemed loyalty points, returns the linked appointment to in_progress, and deletes the appointment's staff tips. A void is written to the audit log with the actor. invoices.voided_at and the voider are stored (migrations 0276 and 0277).

Who can void: the billing.void role toggle (default org_owner, brand_manager, location_manager). A role with only billing.create can void a bill it created itself within 10 minutes (the POS rollback path).

Refunds

There is no single refund screen that covers every case. What exists:

Path What happens
Online card refund (staff) refundRazorpayPaymentAction refunds the invoice's Razorpay payment in full and marks the invoice void. Requires a manager-level role (MANAGER_ROLES)
Razorpay refund.processed webhook Records an invoice_refunds row (source = online, method = online), adds to invoices.refunded_minor, and voids the invoice only when the refunded total reaches the invoice total. Partial refunds leave it open
Product return refunded Resolving a return as refunded records an invoice_refunds row (source = return, method cash or UPI)
Credit note Issued against a client (and optionally an invoice); applying it reduces the invoice total (apply_credit_note), voiding it reverses that

Refund ledger (invoice_refunds, migration 0276, SALO-2384)

One row per refund actually paid out: amount_minor, method (cash, upi, card, online, other), source (online, return, manual), refunded_at, refunded_by, optional reason and provider_refund_id. Unique indexes on the provider refund id and the return id make webhook retries and double clicks idempotent (recordRefund returns false for a duplicate). invoices.refunded_minor stays as the running total per invoice. The Daily Sales report reads this table, so a refund is netted per payment mode on the day it was given, and a refund on a voided bill is skipped.

Credit note statuses: issued, applied, voided.

There is no "exchange" flow in the code.

Return Items

/dashboard/return-items logs retail product returns (return_items):

  • Reason: defective, wrong_item, changed_mind, allergic_reaction, other
  • Condition: unopened, opened, damaged
  • Status: pending, approved, rejected, refunded. A refunded or rejected return cannot be resolved again.
  • Marking a return refunded requires choosing cash or UPI and a store (the return's own location_id, or the active store). It then writes the invoice_refunds row.
  • A return is linked to a client and product but not to the original invoice, and resolving it does not change stock levels. Staff adjust inventory separately.

GST and Tax

  • Each brand has tax_rates (rate, CGST/SGST/IGST split, inclusive or not); the default rate is applied to lines at checkout
  • Tax is computed per line item. Invariant: tax_minor = cgst_minor + sgst_minor + igst_minor (intra-state CGST+SGST, inter-state IGST). Older invoices may carry only tax_minor
  • Lines carry hsn_sac; the invoice shows the GSTIN from invoice settings
  • Tax summaries feed the accounting module (lib/accounting/gst.ts)

Invoice Customisation

Per brand, in invoice_settings (lib/invoice-settings):

  • Business name, address, GSTIN, phone, email, website, logo
  • invoice_prefix and next_number (numbering)
  • footer_note and payment_terms
  • show_tax_breakdown and accent_color

An invoice page (/dashboard/billing/[id]) offers print, share buttons, a Razorpay pay button, and sending the invoice through WhatsApp Business (sendInvoiceViaWhatsAppBusinessAction). An owner can edit a paid bill (location, client, date, notes, lines) with editInvoiceAction; a void invoice cannot be edited.

POS Hardware

Any browser-based device (tablet, desktop) runs the checkout interface. There is no cash-drawer or receipt-printer integration in the code; cash counting is handled by the Cash module (see Cash).

Split Payments

A single invoice can be paid across several tenders in one transaction, for example 300 cash + 200 UPI. Every invoice gets one payment_splits row per distinct method (migration 0087); a single-tender invoice has one row, and a fully complimentary bill has none because amount_minor must be above zero.

  • invoices.payment_method still records the primary method; payment_splits holds the breakdown
  • Each row: invoice_id, method, amount_minor. Duplicate methods entered twice are merged
  • RLS: any org member can read splits for their org's invoices
  • Validation: the splits must sum to the invoice total (splitsCoverTotal, tolerance one paisa). Within the one rupee round-off band, the difference is absorbed into the largest cash-equivalent tender (cash, card, UPI, other), never a balance-capped one (reconcileSplitsToTotal). A wider gap is rejected with the real amounts in the message. The check is skipped when a gift card covers the whole invoice
  • A bill with both services and products is paid as two sub-totals (products due and services due), because some tenders (wallet, promo tenders) are service-only
  • When Razorpay captures the full total, settle_invoice_card_split (migration 0275) replaces the splits with one card row, atomically and idempotently

Retail Products at Checkout

Physical products can appear as line items on any invoice (migration 0089). invoice_lines.product_id is a nullable FK to products:

  • NULL: service line
  • Set: product sold at checkout; stock is decremented through adjustStock(..., "sale") after confirmation. A failure is returned as a warning telling the operator to adjust inventory manually; it does not undo the paid invoice
  • Services with an inventory kit also debit their kit items as back_bar_use

Key Data Entities

  • invoices / invoice_lines: the bill (status draft/paid/void, tax split, round_off_minor, refunded_minor, voided_at, voided_by)
  • payment_splits: one row per payment method per invoice
  • staff_tips: tip for one staff member, written at checkout
  • tip_distributions and tip_distribution_lines: manual split of a tip among staff
  • booking_deposits: online or manual deposits (not deducted at POS)
  • invoice_refunds: refund ledger, one row per refund paid out
  • return_items: retail product returns
  • credit_notes: issued, applied, or voided credit against an invoice
  • gift_cards, wallets: stored-value balances redeemed as tenders

Permissions

Defaults below come from lib/auth/permissions.ts and the action files. Owners can change the toggle rows in Settings, Roles and Permissions.

Action org_owner brand_manager location_manager front_desk stylist
Finalise a bill (billing.create) Yes Yes Yes Toggle Toggle (solo own appointment allowed)
Void a bill (billing.void) Yes Yes Yes Toggle Toggle
Online card refund of an invoice Yes Yes Yes No No
Configure tax rates Yes Yes Yes No No
Edit a paid bill Yes No No No No