Q&A-3Define steady state for a payment workflow.
Answer
Assumptions: card and wallet payments, async authorize→capture, provider webhooks delivered at-least-once, an order service, a payment service, and a ledger that settles against provider reports. Volume around 2M attempts/day.
The answer I'd give first. Steady state is a bounded, flat band on end-to-end invariants, not the absence of errors. Four invariants: every attempt reaches a terminal state within a bounded time; the count of indeterminate (unknown) payments stays flat rather than growing; the ledger reconciles to provider settlement with zero breaks; and duplicate or replayed events are absorbed without a second money movement. Host CPU, queue depth and provider status pages are diagnostic inputs: they explain a drift, they don't define steady state.
Why it's defined that way. The workflow is asynchronous and at-least-once, so at any instant a slice of payments is legitimately in flight. "Zero pending" is the wrong target; a flat pending count is the right one. The dangerous class is the indeterminate payment: authorize timed out, the webhook never arrived, and you don't know whether the provider holds an auth. Those can be resolved twice (double capture) or never (customer charged, order never fulfilled). Steady state means the resolver drains unknowns at least as fast as they're created: inflow ≈ outflow. If inflow exceeds outflow, the unknown set grows monotonically and you are drifting even while every host is green.
Invariants (figures illustrative):
| invariant | steady state | drift signal |
|---|---|---|
| terminal completion | 99.9% of attempts terminal ≤30s | p99 >60s or completion <99.5% |
| indeterminate count | flat, <0.05% of daily volume | monotonic growth over 3 windows |
| duplicate suppression | 0 double-captures/day | any double-capture |
| ledger vs provider settlement | 0 breaks >$0.01 | any break |
| reconciliation queue age | p99 <5 min | p99 >15 min |
Arithmetic that makes it concrete. 2M attempts/day × 0.05% = 1,000 unknowns/day. A resolver on a 5-minute timer runs 288 times/day, so it must clear ~3.5 per run. If it clears 2, the backlog grows 1.5 per run, 432/day, and the indeterminate count stops being flat. That growth, not a red dashboard, is the drift.
Trace of the duplicate case. Client calls authorize, times out at 3s, retries with the same idempotency key. The provider had already authorized the first call, so the retry returns the same auth ID; capture runs once. Without the key: two auths, one capture, one orphan hold. Detection is reconciliation: provider-side auths with no matching capture show up as breaks. Cost is a held line of credit and a support ticket.
Failure modes and how you catch them.
- Webhook loss: the unknown stays unknown. Detected by the age of the oldest indeterminate payment crossing the resolver's SLA. Cost: customer sees "pending", or a retry double-charges.
- Reconciliation lag: queue age p99 climbs. Detected by the queue-age SLO. Cost: settlement mismatch found days late, manual ops.
- Idempotency key reused with a different amount: detected by hashing the payload against the key. Cost: wrong amount captured.
- Single-provider degradation: auth success by decline reason drops for one provider. Segment by provider and region so a global success rate doesn't mask it.
When a simpler definition is enough. For a synchronous, single-provider, low-volume flow where capture is immediate, steady state is just success rate plus a latency SLO: reconciliation invariants earn their keep only once settlement is async or you run multiple providers. And tightening every threshold to zero causes alert fatigue; the indeterminate-count invariant is the one that protects correctness, so it gets the tightest band.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.