Reconciliation

Backed by: @pithy-sh/payments. Scope: payments:purchases:read for the runs.

The question it answers

Webhooks and replay is the mechanism it exists to backstop, purchases and entitlements are what it repairs, and refunds and lapses is what it is usually catching up on.

Why didn’t this renew?

Everything not yet finished with, oldest first — pending, failed and abandoned alike, because all three are deliveries whose purchase has not been projected.

processedAt means finished with, never seen

abandonedAt is a second timestamp rather than a status column, and it sits beside processedAt rather than replacing it.

Abandoning is the sweep’s decision about its own progress; finishing is a fact about the purchase. Collapsing them into one column is the same defect again.

That an abandoned event appears in this list is deliberate — it is exactly the row somebody has to be able to find, and abandonedAt beside it says which of the three it is.

A note and an error are opposites

Both read as why nothing happened to a person. In the row they are not the same:

A note is why nothing was ever going to project. The row is finished.

An error is why this attempt did not. The row stays repairable.

Each call site says which it means, rather than letting the mere presence of a reason decide.

Verified is not new

The signature proves a delivery is authentic and fresh, never that it is new.

Inside the tolerance window a captured delivery replays as many times as it is sent — which is why UNIQUE (rail, providerEventId) exists, and why every provider’s at-least-once retry is recognized rather than reprocessed.

The attempts counter

Beside processedAt and error, because the three are only ever read together: it arrived, it was tried N times, here is why it still has not gone through.

A side table would add a join for the one question anybody asks, and a way for the two to disagree.

Repairing one

Grant the entitlement — which is what payments:entitlements:grant is for, and why its own page calls it comp or repair a purchase that verified but never projected.

A grant of a key no product sells is refused, unless you declared it manually.

ESC