Skip to content

Everything After "Money Received"

Learning objectives

  • Why automated coverage naturally concentrates upstream of the payment event, and what that leaves unguarded
  • How a correctly-written handler can make a failure structurally invisible — no error, no retry, no alert, no complaint
  • Why a third-party API version is a contract that moves under you while every status code stays green
  • Why configuration that lives outside version control drifts, and how identical code can behave differently in two places
  • Why "fast" describes one call and not one answer
  • What it means to walk a journey rather than test its components

The shape of the gap

Here is a pattern worth internalizing before it costs you anything.

Take a purchase path with genuinely good test coverage — signup exercised, input validation exercised, payment initiation exercised, the money event itself hardened against replay and tampering. Now walk that path by hand, as a customer, with a real card, from the first click to the moment the thing you bought is usable. Count the defects.

In the case that produced this article, every single one of them was after the point where the payment succeeded. Not one was upstream. Not one would have been caught by another unit test, another integration test, or another dashboard.

That is not bad luck, and it is not a comment on the team's discipline. It is a structural property of how verification effort gets allocated, and it shows up in almost every codebase that handles money.

Coverage clusters where the engineering feels risky

Engineers write tests where they feel danger. The payment event feels dangerous: it has signatures to verify, amounts to match, replays to absorb, an external system that can lie or repeat itself. So it gets hammered. Everything leading up to it — the form, the validation, the session, the initiation call — sits on the same well-lit path and gets hammered along with it.

Then the payment succeeds, and the felt risk drops to zero. What remains is "just" a confirmation page, "just" a receipt email, "just" flipping the account into its active state. None of it feels like engineering. All of it gets a fraction of the attention.

Invert the customer's point of view and the allocation is exactly backwards. Before payment, a customer who hits a broken step loses nothing — they close the tab. After payment, that same customer has already paid, cannot undo it themselves, and has no path forward except your support queue. Commitment is maximal and recoverability is minimal at precisely the point your coverage thins out.

The rule that falls out: effort should follow the customer's exposure, not the engineer's sense of difficulty. The post-payment steps are the ones where a defect converts directly into a person who is out of pocket and stuck.

Some failures are invisible by design

This is the subtlest concept in the article, and the most valuable.

Consider a webhook handler receiving payment events. Good practice says: if you receive an event you cannot act on, do not fail. Returning an error makes the sender retry, and retrying something structurally unresolvable is a retry storm that will never converge. So the correct engineering answer for an event you cannot attribute to anything is to acknowledge it — answer "received", stop the retries, move on.

That is right. And it creates a hole with a very particular shape.

Suppose attribution breaks — the identifier that ties a payment back to the account that made it goes missing for some reason. Now trace what the system does:

  • The payment succeeds. The customer is charged. Their statement is correct.
  • The handler receives the event, cannot attribute it, and correctly answers "received."
  • The sender is satisfied and stops. No retry.
  • No exception is raised, so no error is logged.
  • No error is logged, so no alert fires.
  • The customer sees a successful charge, so they do not complain — from their side, the payment worked.
  • The work they paid for never happens.

Every component behaved correctly. The money moved. The value did not. And there is no signal anywhere in the system that anything is wrong, because "nothing happened" is not an event.

Monitoring cannot find this, because monitoring watches for things that happen. Tests rarely find it either, because the test that would catch it is not "does the handler process a valid event" — it is "what does the system do when the handler is handed an event it cannot place," and that branch is usually written as a one-line early return with a shrug.

The defence is to make the silent branch loud. Swallowing the retry is correct; swallowing the information is not. Every unattributable money event must emit an explicit, human-directed notification carrying everything known about the event, so a person can complete the work manually. Answer the sender "received"; tell your own operators "unresolved." Those are two different audiences and they need two different answers.

Generalize it past payments: anywhere your code deliberately absorbs a condition to protect the system, ask what tells a human it happened. If the answer is nothing, you have built a place where reality and your records can silently diverge.

A third-party API version is a contract that moves

Attribution breaks for mundane reasons, and here is the most common one.

You integrate with a provider. In the version you build against, the identifier you need sits at a particular location in the payload. You read it from there. Everything works, and the code is correct — for that version.

Later, the version moves. Maybe the account's default version is bumped somewhere in a dashboard; maybe a library upgrade changes the version the client requests; maybe the provider migrates you. In the new version, the provider reorganized the payload and that identifier now lives one level down, or under a different name, or nested inside a related object.

Nothing errors. Every status code is still 200. Every signature still verifies. The field you read is simply absent now, so you read nothing, and you fall into exactly the invisible branch described above.

This class of break has three defences worth adopting together:

  1. Read defensively across shapes. When you know a field has lived in more than one location, read both, in order, and take the first that is present. This costs a line of code and makes a version bump in either direction — forward or a rollback — a non-event.
  2. Pin the version explicitly in the client rather than inheriting whatever the account default happens to be. An account-level default is configuration someone can change without touching your repository.
  3. Treat a missing critical field as an incident, not an absence. If the identifier that makes a payment meaningful is not there, that is the loudest thing that has happened all day.

The mental model to keep: an external API version is not a static contract. It is a contract with an expiry you did not write and a renewal you may not be told about.

Configuration that lives outside version control drifts

Here is a failure mode that survives every good practice you already have.

Suppose a piece of policy or configuration is pushed to each environment by some separate mechanism — a job, a script, a manual step — rather than being reconciled continuously from a source of truth. The push happens, the environments agree, everyone moves on.

Then a change goes out while one environment is offline, or paused, or mid-maintenance. The push reaches the environments that are up. The one that is down misses it, silently, and nothing ever comes back to correct it — because pushes are events, and events that fail to arrive leave no trace.

The result is the most confusing bug class in existence: identical application code, identical deployment manifests, and different behaviour. Every artifact you would think to compare matches. The thing that differs is not in any of them.

Two rules keep this from happening:

  • Configuration is source, not a side effect. Whatever governs behaviour belongs in version control, and each environment should converge on that source continuously — pulling and reconciling, so an environment that was offline catches up on its own when it returns.
  • Verify the live value, not the push. "The job reported success" is not evidence. The evidence is reading the running configuration's identity back out of each environment and confirming it matches the source revision. A deploy that cannot be verified from the outside has not been verified.

A small one, with an outsized blast radius.

Marketing email platforms rewrite links so clicks can be counted: the destination is replaced with a redirect through a tracking domain, and the tracking domain has to be configured and reachable. That machinery is harmless for a newsletter — a broken link means an unread article.

Now apply it to a security-sensitive message: a verification link, a password reset, a confirmation the customer must act on to receive what they bought. Click tracking inserts a third party in front of a security-critical link, and if the tracking domain is misconfigured or unresolvable, every link in the message is dead. The email arrives. It looks perfect. It simply cannot be acted upon.

The rule is categorical: transactional and authentication email carries its real links, unwrapped. Turn click tracking off for that stream entirely. You are not measuring engagement on a password reset; you are delivering a mechanism. Anything inserted between the customer and that mechanism is a new dependency on the most sensitive path you own — and one whose failure looks exactly like success from your side, since the message was sent.

"Fast" describes one call, not one answer

A different flavour of the same blind spot, this time in performance.

An assistant feature is measured, and the model calls are fast. The number looks good, gets quoted, and everyone relaxes. Then a customer asks a question and waits noticeably longer than the number suggests.

The reason is arithmetic. If answering one question requires several sequential round-trips — classify the intent, decide what to retrieve, retrieve, then compose — the customer waits for the sum, plus the overhead between each hop. Per-call latency is a component metric. It is not the number anyone experiences.

The habit to build: measure the unit the customer perceives. For an assistant that is question-in to answer-visible, on a realistic question, over a realistic network. If that number is disappointing, the fixes are architectural — collapse round-trips, run independent steps concurrently, stream partial output so the perceived wait starts at the first token rather than the last. None of those improvements show up in per-call timing, which is precisely why per-call timing was never the right instrument.

The general principle: walk it yourself

All of the above shares one root cause. Tests verify components against expectations that were written by the same people who wrote the components. Monitoring verifies that things which happen are healthy. Neither one experiences the journey.

So walk it. As a customer, on the real system, with real money, from an account that does not exist yet to the moment the purchased thing is usable in your hands. Open the confirmation page. Wait for the email in the inbox it actually lands in — not the log line saying it was sent. Click the link. Log in. Use the feature you paid for. Notice the waiting.

A component test asks "does this function return what I expect?" A walk asks "can a stranger who just paid you actually get what they bought?" Those are different questions, and only one of them is the one your customer is asking.

Do it before a customer does. The defects you find on that walk are ordinary — a missing branch, a moved field, a stale environment, a rewritten link. What makes them expensive is not their difficulty. It is that they all live in the stretch of the path where the customer has already paid, has no way back, and no way to tell you.

The takeaway

Verification effort concentrates where the engineering feels risky — which is upstream of the money event. Customer exposure concentrates downstream of it, where they have paid, cannot recover, and often cannot even tell you. Close that gap deliberately: make every silently absorbed branch emit a human-directed notification, read third-party payloads across old and new shapes, reconcile configuration from version control instead of pushing it, strip link rewriting from transactional email, and measure latency as the customer experiences it. Then walk the whole path yourself, as a customer, before one of them does it for you.