All entries

    Model Payment Status as a State Machine

    Use explicit transitions to protect payment state when notifications arrive late or out of order.

    A hand stamps a payment status while older envelopes wait nearby
    Conceptual pixel-art illustration.

    Use explicit transitions to protect payment state when notifications arrive late or out of order.

    Build the example

    For a synthetic purchase, define created, authorized, captured, failed and disputed events. Decide which transitions can advance the aggregate and which require review. An authorization arriving after a confirmed capture should not lower the state. A chargeback should be modeled separately from a transient delivery failure.

    Add a ledger event for an ambiguous transport timeout during capture. The attempted operation should remain visible while the payment is reconciled. An event received later can resolve that state after the expected identifiers and amount match. Keep the one-time notification effect keyed to the actual successful capture, independent of delivery ordering.

    EXPLAINED / STATE CONTRACT

    Out-of-order payment deliveries

    Use explicit transitions to protect payment state when notifications arrive late or out of order.

    Example

    1. Capture arrives

      record a verified capture

    2. Authorization arrives later

      retain capture

    3. Capture repeats

      acknowledge without a second effect

    THE KEY DISTINCTION

    acknowledge without a second effect

    Conceptual diagram for the synthetic example in this guide.

    Watch the failure boundary

    Keep provider events immutable and derive the current state separately. This lets a reviewer investigate a late event without losing the original sequence. Distinguish attempts from successful captures when deciding whether a second request is safe. When provider state and local rules disagree, retain the event for reconciliation with clear ownership.

    Verify the behavior

    Send captured, authorized and the same captured event again. Keep the capture applied exactly once. Then inject a mismatched currency and a capture with the wrong order reference. Both should be quarantined for review. Use a transaction or atomic conditional write for the transition and its event record.

    FURTHER READING

    Sources

    Technical references checked .

    END OF ENTRY / 57
    Eeshan Singh with Big Ben in London
    BEHIND THE JOURNAL

    Eeshan Singh

    I’m Eeshan Singh Pokharia, an AI Full Stack Developer and CoFounder of UltraFit360. I work across AI features, full-stack product development, and web and mobile experiences—from Figma and frontend interactions to the systems behind them.

    Keep provider events immutable and derive the current state separately. This lets a reviewer investigate a late event without losing the original sequence. Distinguish attempts from successful captures when deciding whether a second request is safe. When provider state and local rules disagree, retain the event for reconciliation with clear ownership.

    Meet the author
    THE CONVERSATION

    Your side of the story.