E-commerce Ledger Integration: From Purchase to Payout

I was three months into building an e-commerce platform when our accountant asked a simple question that broke everything: “When a customer pays $100, and we keep 10% as commission, and Stripe takes 2.9% + 30¢, how much does the merchant actually receive?” I looked at my database schema and felt the familiar sinking feeling that I was missing something obvious. The math was simple—$100 - $10 - $3.20 = $86.80—but the tracking wasn’t. When did the merchant earn that money? When the customer paid? When the item shipped? When we transferred it? What if the customer refunded? What if the item was backordered for three weeks? ...

March 24, 2026 · awbuana

Building a Ledger System - Chapter 2: Transaction Lifecycle

This is the second chapter in our five-part series on building production-ready ledger systems. In Chapter 1, we covered double-entry bookkeeping, data modeling, and transaction validation. Now we’ll explore transaction state management and async processing. Layer 3: Transaction Lifecycle Real-world transactions aren’t instantaneous. They go through states: stateDiagram-v2 [*] --> Pending: Create Pending --> Validating: Submit Validating --> Rejected: Invalid Validating --> Validated: Valid Validated --> Reserving: Reserve Funds Reserving --> Failed: Insufficient Reserving --> Reserved: Reserved Reserved --> Posting: Post Posting --> Posted: Success Posted --> Reversing: Reverse Reversing --> Reversed: Reversed Rejected --> [*] Failed --> [*] Posted --> [*] Reversed --> [*] The Pending → Validated → Reserved → Posted flow matters because: ...

March 21, 2026 · awbuana