Illustrative diagnostic — synthetic records

Fictional system and synthetic records. Not a client engagement, real production incident, commercial outcome or proof of a deployed fix.

Payment confirmed, credit missing.

Agreed question

Can a confirmed payment lose its matching internal credit when a write fails and the provider retries?

Scope and fictional conditions

One confirmation path across a fictional provider, callback handler and internal ledger.

  • This example assumes the provider retries after a non-2xx response.
  • The receipt marker commits separately from the ledger write.

Those are explicit fictional conditions, not assertions about a particular payment integration.

Illustrative diagnostic — synthetic records

Payment confirmed. Credit absent.

ProviderP-104 · 10:00:00

Payment succeeded

LedgerL-104 · 10:00:01.040

Write failed

Expected matching credit — absent

Comparison · C-104 · 10:10:00No matching internal credit.Unresolved

Synthetic timeline

8 records · fictional provider, handler and ledger
  1. 10:00:00P-104

    Provider marks payment succeeded.

    SucceededTracingReferenced record
  2. 10:00:01.000E-104

    Callback with event key evt-104 reaches the handler.

    Callback receivedTracingReferenced record
  3. 10:00:01.020H-104

    Handler commits a receipt marker for evt-104. It has not yet committed a credit.

    Receipt storedTracingReferenced record
  4. 10:00:01.040L-104

    The ledger write fails; no matching credit exists.

    × Write failedTracingReferenced record
  5. 10:00:01.050H-104-RESPONSE

    Handler returns HTTP 500. The provider records failed delivery.

    × HTTP 500TracingReferenced record
  6. 10:05:00.000R-104

    Provider retries the same event after the failed delivery.

    RetryTracingReferenced record
  7. 10:05:00.020R-104-RESPONSE

    Defective duplicate check sees the receipt marker, skips the credit and returns HTTP 200.

    ≠ HTTP 200 · credit skippedTracingReferenced record
  8. 10:10:00C-104

    Synthetic comparison shows provider succeeded, receipt present, internal credit absent.

    ≠ UnresolvedTracingReferenced record

Finding F-01

Receipt is being treated as completion.

Observed within this constructed record set

The first delivery failed after receipt; the second returned success without a credit. The duplicate check distinguishes seen/not-seen, not complete/incomplete.

RecordsH-104L-104H-104-RESPONSER-104-RESPONSEC-104

Inferred — to investigate in a real system

The deduplication marker and recoverable business outcome are not aligned. A retry can suppress the very work that failed.

RecordsH-104R-104-RESPONSE

Still unknown — a real engagement must resolve

Actual transaction boundaries, queue guarantees, database isolation, processing state, crash recovery, concurrent delivery and reconciliation policy. These records alone do not select a universal implementation.

No record in this set answers these questions.

Recommendation

Define a durable processing state and a recovery path. Preserve exactly-one business credit as an invariant while permitting retries of incomplete work. Choose atomic writes, a recoverable inbox/worker pattern or another design only after inspecting actual guarantees. Do not equate delivery acknowledgement with completed business effect.

Verification checks to design and run with authorisation

  1. Fail the ledger write after the receipt marker is stored. On retry, require one eventual credit or a visible unresolved exception—never a silent missing credit.
  2. Deliver the callback repeatedly and concurrently. Require one business credit, not one per delivery.
  3. Restart at each relevant commit boundary. Prove recovery from persisted state.
  4. Reconcile provider success against the ledger; surface the unmatched event with its evidence reference.

No checks above are represented as executed client tests. The sample demonstrates the proposed deliverable’s clarity and reasoning. It does not prove commercial results.

Download the synthetic diagnostic (Markdown)

Which workflow needs a closer look?

Describe what should happen, what happens instead and which systems are involved. Start with a short, non-sensitive account—not credentials, customer records or raw production logs.