The Northwind Operations Reference2nd edition
Chapter 3

Payments that time out

Why night-time card declines were timeouts, and the retry that fixed them.

3.1The declines were timeouts#

Nine in ten night-time declines were the bank's fraud check timing out, not a decision about the card. A timeout is not a decline: it is a bank that has not answered yet.

3.2One idempotent retry#

Retry.javaJava
var key = order.id();
var result = bank.authorize(card, amount, key);
if (result.isTimeout()) {
    sleep(Duration.ofSeconds(30));
    result = bank.authorize(card, amount, key);
}
return result;
  1. The order id is the idempotency key: a retry is the same request.
  2. One retry only, thirty seconds later.

The retry changes nothing for the stations after payment; see Section 1.2. The retry is logged with both attempts.