What does Payment Routing, Chargebacks and Cash Reserves conclude, in numbers, about “A Formula for the Minimum Safe Reserve, and Spreading over Gateways”?
Answer: Chapter 6 gives an approximate formula for the minimum safe reserve and finds that the greatest risk is a gateway freeze: one gateway needs RM 3,114,683, four only RM 1,258,468.
Scope of the numbers: Chapter 3 writes friendly fraud as a game of deterrence: once the win probability reaches 0.75, false disputes vanish in the illustrative model; in an evidence package the "considered purchase" tick counts least. Marked boxes separate published evidence, runnable Python calculations (16 programs), classical sources and the author's hypotheses.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 1258468, 3114683
| gateways | cash needed (99%) RM | share of paths with a freeze |
| 1 | 3,114,683 | 0.463 |
| 2 | 2,026,860 | 0.687 |
| 3 | 1,532,138 | 0.818 |
| 4 | 1,258,468 | 0.907 |
Key formula
Show the full program
# Chapter 6. p12: Spreading volume over several gateways. The business of
# p10 (10% rolling reserve for 90 days) splits its card sales evenly over
# k gateways. Each gateway, independently, freezes all payouts at random
# times (0.3 freezes a year); a freeze lasts 90 days, after which the
# held money is paid out. Costs and refunds go on. Cash needed so that
# the balance stays above zero over two years in 99% of 1,000 paths.
# Seed 85.
import importlib.util
import random
def load(name):
spec = importlib.util.spec_from_file_location(name, name + ".py")
m = importlib.util.module_from_spec(spec)
spec.loader.exec_module(m)
return m
p10 = load("p10_rolling_reserve")
V, PAY, R, H = p10.V, p10.PAY, 0.10, 90
def path(rng, k, days=730):
frozen_until = [0] * k
owed = [0.0] * k
cash, low, froze = 0.0, 0.0, False
for d in range(days):
for g in range(k):
if frozen_until[g] <= d and rng.random() < 0.3 / 365:
frozen_until[g] = d + 90
froze = True
share = V / k
due = 0.0
if d >= 2:
due += (1 - R) * PAY * share
if d >= H:
due += R * PAY * share
if frozen_until[g] > d:
owed[g] += due
else:
cash += due + owed[g]
owed[g] = 0.0
refunds = p10.REF * V * (3 if 300 <= d < 314 else 1)
cash -= p10.COST * V + refunds
for _ in range(p10.shocks(rng, 2 / 7)):
cash -= rng.expovariate(1 / 8000.0)
low = min(low, cash)
return -low, froze
if __name__ == "__main__":
rng = random.Random(85)
print(" gateways cash needed (99%) RM share of paths with a freeze")
for k in (1, 2, 3, 4):
runs = [path(rng, k) for _ in range(1000)]
s = sorted(x for x, _ in runs)
print(" {:8d} {:20,.0f} {:.3f}".format(
k, s[989], sum(1 for _, f in runs if f) / 1000))Single source and citation
Fan, Y. (2026). Cross-Border Payment Routing, Chargeback Defense Games and Treasury Ruin Bounds (Version 1.0.0), Chapter 6: A Formula for the Minimum Safe Reserve, and Spreading over Gateways. 5D Library. https://doi.org/10.5281/zenodo.24090225
DOI: 10.5281/zenodo.24090225 · Read the monograph · 5DL-B-085 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026085,
author = {Fan, Yafu},
title = {Cross-Border Payment Routing, Chargeback Defense Games and Treasury Ruin Bounds},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
doi = {10.5281/zenodo.24090225},
url = {https://doi.org/10.5281/zenodo.24090225}
}Other chapter answers in this book
- Chapter 1 · Multi-Acquirer Routing and the Chargeback Red Line
- Chapter 2 · A Ratio Is a Noisy Count, and Refunds Must Beat Disputes
- Chapter 3 · The Defence Game against Friendly Fraud, and Scoring the Evidence
- Chapter 4 · A Cryptographic Evidence Chain, and "Fight or Pre-Empt"
- Chapter 5 · The Cramér-Lundberg Model and the Rolling Reserve
- Chapter 7 · Song Maritime Customs Levies, and the Secret Codes and Transfers of the Shanxi Remittance Banks
- Chapter 8 · A Year's Ledger, Stress Tests and a Pre-Registered Experiment