At a glance
- I built the working split-payment system across the luca POS client and backend.
- The order tracks the remaining bill; each portion has its own payment, fiscal, and refund lifecycle.
- Staff can pay selected items or an amount, using cash and card across successive portions.
- A failed attempt can be retried on the same portion; completed portions retain their payment and receipt details.
- The backend validates allocations and stores VAT snapshots for fiscalization and reporting.
One bill, two lifecycles
A restaurant bill can be settled through several payments. I built the POS flow and backend model around two separate questions: what remains payable on the order, and what happened to each payment portion. A successful portion settles its own amount; the order stays open until completed portions cover the payable basket. A split group organizes a checkout session, while the order’s payment status comes from the basket and completed payments.
This let staff collect one portion, return to the split hub, and choose a different shape or payment method for the remainder. The entire bill did not need an upfront payment plan.
Allocations and payment attempts
For a line-item portion, the backend checks selected quantities against unpaid items and verifies that the portion amount matches their gross value. It stores item and VAT snapshots with the portion. For an amount portion, VAT is allocated across the remaining basket’s tax buckets. Once an amount payment has completed, a later line-item split is blocked because that payment has no allocation to specific item quantities.
The backend’s committed portion state is authoritative when the POS rebuilds the split hub. A failed payment remains a retryable attempt on the same portion; it does not create another payable share. In the HTTP payment path, a per-portion lock guards validation, fiscal signing, and persistence against simultaneous attempts for that portion. Cash entry also keeps the amount due separate from cash tendered, preserving the portion amount when change is returned.
Consider an illustrative €40 bill: staff pay €15 of selected items by card, then start a €10 amount portion whose first card attempt fails. They retry that €10 portion with cash and later pay the remaining €15. The order remains open through the first two successful portions and closes when the final portion covers the rest. The failed attempt stays attached to its original portion instead of increasing the bill.
Settlement, refunds, and records
A completed portion keeps its settlement identity when a partial or full refund is recorded. Refunds change net-paid reporting but do not add the refunded amount back to the collectible remainder or reopen a settled order on their own. Tips and surcharges likewise remain separate from the bill’s payable obligation. This keeps settlement, refund accounting, and the next amount to collect distinct.
Each portion carries the data needed for its fiscal event and later inspection. Line-item receipts show the quantities paid by that portion; payment history shows the method, status, tips, and partial refunds. The stored VAT snapshots support TSE signing, fiscal reporting, and refund records without rebuilding a past payment from the order’s current basket.