HomeCase studiesOmnichannel Customer Loyalty Platform and Double-Entry Points...

Case study · Lisbon, Portugal

Omnichannel Customer Loyalty Platform and Double-Entry Points Ledger Built with Laravel, Vue, and MySQL

Omnichannel Rewards & Retention CRM

Retailers running separate e-commerce coupon scripts and in-store punch cards suffer from broken customer balances, un-reconciled points liability, and slow checkout redemptions. We engineered an omnichannel customer loyalty platform using Laravel, Vue, and MySQL. A strict double-entry points ledger tracks pending, earned, expired, and clawed-back balances accurately, while a composable rule engine evaluates tier multipliers and delivers sub-second reward validation across physical POS registers and online storefronts.

Industry
Omnichannel Rewards & Retention CRM
Solution
An omnichannel loyalty, double-entry points accounting, and dynamic retention campaign platform built with Laravel, Vue, MySQL, Redis, and Laravel Horizon.
Platforms
Web & API
Stack
Laravel · Vue · MySQL · Redis · PHP · TypeScript
Location
Lisbon, Portugal · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Lisbon, Portugal. Names withheld by agreement.

Project Overview

Retailers expanding across physical stores and digital storefronts frequently bolt together disconnected loyalty plugins—an online discount script here, a separate POS phone-number lookup there. Customers immediately feel the seams when points earned online vanish at the cash register, while finance teams inherit un-auditable points balances that distort quarterly liability reporting.

Built for an omnichannel retail and hospitality network in Lisbon, we engineered a customer loyalty platform using Laravel, Vue, and MySQL. The system unifies point accrual, tiered perks, and instant reward redemptions behind a strict double-entry accounting ledger, serving physical POS registers, web checkouts, and an interactive Vue CRM workspace from one coherent core.

Loyalty Fragmentation & Liability Risk

Scaling rewards across brick-and-mortar registers and online carts exposes four persistent architectural failures:

  • Mutable balance corruption: Overwriting a single points_balance column leads to race-condition double-spends during concurrent checkouts and leaves zero trail for customer disputes.
  • Uncontrolled financial liability: Without strict expiration buckets and pending-return holds, unredeemed points accumulate indefinitely on the balance sheet without clear breakage accounting.
  • Brittle hardcoded promotions: Launching weekend category multipliers or VIP early-access vouchers often requires developer deployments when marketing rules live in controller code.
  • Slow POS register lookups: Heavy relational queries stalling at the cash register force cashiers to skip loyalty capture whenever queues build up.

Architectural Strategy

We modeled the loyalty engine on immutable double-entry accounting in MySQL 8 paired with in-memory rule evaluation in Laravel. Rather than mutating balances directly, every earn, hold, redemption burn, manual adjustment, expiration sweep, and refund clawback appends balanced debit/credit journal rows tied to source transaction IDs and expiration cohorts.

Laravel serves versioned REST APIs to store POS terminals and e-commerce checkouts while Horizon workers offload batch tier evaluations and scheduled expiry notifications. A modular Vue 3 interface gives CRM teams a visual rule builder and equips finance controllers with drill-down liability reconciliation without touching production SQL.

Core Capabilities

  • Double-Entry Points & Expiration Ledger: Tracks pending, available, redeemed, expired, and clawed-back points using FIFO expiration consumption across distinct campaign cohorts.
  • Composable Rules & Tier Engine: Enables marketers to configure spend thresholds, SKU/category exclusions, birthday bonuses, and dynamic tier upgrades inside Vue without code changes.
  • Omnichannel POS & Checkout Redemptions: Validates QR/NFC member tokens, reserves points atomically during checkout authorization, and finalizes or releases holds upon payment confirmation.
  • Return & Fraud Clawback Handling: Listens to upstream order-refund webhooks to void pending earns or record transparent debit reversals automatically.
  • Segmented Member Portal: Lets shoppers inspect point histories, track progress toward their next VIP tier, and redeem digital reward vouchers across web and mobile browsers.
  • Finance Liability & Breakage Exports: Generates auditable period-end summaries detailing issued, burned, and expired point liabilities by store and partner brand.

Technical Architecture

POS registers and storefront checkouts transmit signed purchase and redemption payloads to stateless Laravel API endpoints. Redis coordinates distributed member locks and caches compiled campaign rules, MySQL commits balanced ledger entries atomically, and Laravel Horizon executes downstream tier promotions, Meilisearch index syncs, and member notifications.

Flow: Physical POS & E-Commerce Checkout → Laravel API Gateway + Redis Idempotency Lock → In-Memory PHP Rule Evaluator → MySQL Double-Entry Ledger & Expiration Buckets → Laravel Horizon Workers → Meilisearch & Notification Dispatch → Vue CRM & Member Portal

Separating fast synchronous point quotes and two-phase redemptions from asynchronous tier recalculations keeps cash-register checkout latency predictable even during weekend promotional spikes.

Technology Stack

Category Technology detail
Merchant & Member UI Vue 3 and TypeScript powering CRM campaign builders, finance liability reports, and member reward portals
Core Loyalty API Laravel 11 and PHP 8.4 serving POS redemption endpoints, e-commerce webhooks, and rule evaluation
Double-Entry Ledger MySQL 8 persisting immutable credit/debit point journals, expiration buckets, and tier history
Async Campaign Engine Laravel Horizon processing bulk tier recalculations, birthday grants, and expiry notices
Balance & Lock Cache Redis enforcing checkout idempotency keys, atomic redemption locks, and hot balance reads
Member Search Meilisearch enabling instant phone, email, and loyalty-card lookups at busy store POS registers
POS & Storefront SDKs Signed REST webhooks and QR/NFC wallet passes connecting physical cash registers with online checkouts
Audit & Export Bus Scheduled accounting exports breaking down earned, redeemed, and expired points liability for finance teams

Engineering Trade-offs & Solutions

Engineering Challenge Solution & Trade-off
Summing millions of ledger rows on every balance inquiry slows checkout endpoints Maintained a transactionally updated balance cache column synchronized inside the same MySQL commit as journal entries, periodically verified against full ledger sums.
Expiring points cleanly across millions of members risks long nightly table locks Tracked remaining unspent balances per credit bucket and processed Horizon expiration sweeps in cursor-chunked batches with FIFO burn tracking, trading slightly richer write logic for zero lock contention.
Allowing freeform promotional scripting inside CRM UIs introduces security and performance risks Restricted marketers to a declarative JSON condition/action AST evaluated safely by pure PHP classes, balancing flexibility against deterministic safety.
POS checkout drops halfway through payment after points are deducted Implemented a two-phase reserve and commit/release ledger flow with automatic Redis/Horizon TTL expiration on abandoned holds, preventing stranded customer points.

Ledger Integrity & Fraud Prevention

Points carry real monetary value, making replay attacks, race conditions, and staff abuse primary security concerns. Every POS and e-commerce integration authenticates via scoped HMAC-signed webhooks and requires unique client-supplied idempotency keys on all earn and burn requests. Network retries during spotty store Wi-Fi replay the original response rather than crediting points twice.

Concurrent redemptions serialize through Redis distributed locks backed by MySQL SELECT ... FOR UPDATE row locks on the member's active credit buckets. Anomaly detectors running on Horizon monitor high-frequency manual adjustments by store staff, oversized same-day receipt claims, and suspicious multi-account referral loops, flagging accounts for supervisor review before high-value reward vouchers unlock.

POS Redemption Speed & Batch Campaigns

When a queue forms at a busy Lisbon checkout counter, cashiers cannot wait on multi-table SQL joins. Meilisearch resolves fuzzy customer lookups by name, phone, or card ID in milliseconds, while Redis serves pre-compiled active promotion rules and current point balances directly to Laravel's calculation pipeline.

Heavy CRM operations—such as evaluating annual tier downgrades, issuing mass seasonal bonus drops, or expiring dormant balances—run exclusively through dedicated Laravel Horizon supervisor queues with configurable throughput limits so batch marketing jobs never starve live POS traffic.

Operational Outcomes

Consolidating fragmented store and web rewards onto an auditable Laravel and MySQL ledger transformed both customer engagement and financial governance:

  • Unified omnichannel balances: Shoppers earn and spend points seamlessly between physical retail counters and online carts with instant balance synchronization.
  • Audit-grade accounting clarity: Double-entry MySQL journals and FIFO expiration tracking give finance teams clear visibility into active reward liabilities and monthly breakage.
  • Zero-deployment campaign agility: Marketing teams configure seasonal multipliers, VIP perks, and category exclusions directly in Vue without waiting on engineering releases.
  • Resilient checkout reliability: Two-phase point holds and idempotent POS endpoints protect customer balances even when store connectivity drops mid-transaction.

01 — Questions

asked about this kind of project

Why build a double-entry points ledger instead of simply incrementing a balance column on the user row?

A mutable balance integer cannot explain how points were earned, block partial expirations cleanly, or reconcile unredeemed liability for finance audits. Double-entry journal rows in MySQL record every credit, pending hold, redemption debit, and refund clawback immutably, making balances mathematically verifiable.

How does the system handle product returns after a customer already spent the earned points?

Initial earn entries can sit in a configurable pending state until the return window closes, or claw back via an explicit debit reversal entry upon refund webhooks. If a customer already spent those points, the ledger records a transparent negative balance reconciled automatically on future purchases.

How do you prevent double-spending points when a customer taps Redeem simultaneously on mobile and at a POS?

Every redemption request acquires a Redis distributed lock keyed by member ID alongside a transactional MySQL row lock on the member's balance summary and FIFO expiration buckets, ensuring concurrent requests serialize cleanly.

How does Laravel evaluate complex promotional rules without slowing down checkout?

Active campaign rules compile into lightweight cached JSON rule trees in Redis. At checkout, PHP evaluates cart category exclusions, tier multipliers, and active bonus windows purely in memory without heavy database joins.

Why pair MySQL with Meilisearch for loyalty member lookups?

Physical cashiers frequently search customers by partial phone number, typo-prone email, or loyalty card prefix under line pressure. Meilisearch answers fuzzy lookups in milliseconds while MySQL remains the strict transactional source of truth for ledger commits.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.