ENGINEERING NOTE 47 / 50 · CARD

Stop late responses from overwriting payment progress

OPEN RAMBO ·

A slower earlier request can arrive after a newer one. Version the state you render so a pending response cannot overwrite a confirmed result.

Published by OPEN RAMBO. The engineering patterns and pseudocode illustrate designs, not a documented product API. Numerical examples are illustrative.

Use authoritative versions

Include a monotonic version or another documented ordering token with operation state. Client request numbers can help discard local races, but do not establish global business order across tabs or devices.

Keep buttons tied to operations

Disable duplicate submission while the original operation is unresolved, but provide a status refresh. A page reload should restore the existing operation reference. Avoid treating a component remount as permission to issue another load request.

Handle disagreement

If two authoritative responses contradict each other without comparable versions, show a reconciling state and fetch the canonical operation. Do not resolve financial disagreement by whichever response happened to arrive last in the browser.

Illustrative implementation

if incoming.version >= current.version:
    current = incoming
else:
    ignore_stale_response(incoming)

Acceptance check

Delay a pending response until after confirmation, then reload the page. The completed operation should remain identifiable and not submit again.

Read next