5D Library › 跨境支付智能路由、拒付抗辩博弈与资金池破产边界 · English

第八章 全年账本、压力测试与预注册实验

一年 144,000 笔订单的账本

把前七章的部分拼在一起。三种做法:A 全部走卡、人工整理证据(胜诉 0.35,每案 RM 60)、7 天内退款、没有预警服务、一个网关;B 按 0.9% 路由、自动证据包(胜诉 0.711,每案 RM 15)、1 天内退款;C 在 B 之上再加拦下 30% 争议的预警服务与三个网关。

推导

# Chapter 8. p14: A year's ledger for 144,000 orders (12,000 a month),
# putting the pieces together. Setups:
#   A  all on cards, evidence prepared by hand (win 0.35, RM 60 a case),
#      refunds paid in 7 days, no alert service, one gateway;
#   B  the 0.90% routing of p01, automatic evidence package (win 0.711,
#      RM 15 a case), refunds within 1 day;
#   C  as B, plus alerts that catch 30% of disputes, and three gateways.
# Margin from p01, friendly fraud from p05, the refund season from p04
# (one peak month a year), alerts from p08, the cash buffer from p12.
import importlib.util

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

p01, p04 = load("p01_routing"), load("p04_refund_speed")
p05, p12 = load("p05_deterrence"), load("p12_gateways")
YEAR = 144000 / 10000                   # units of 10,000 orders

def setup(x, w, prep, days, caught, k, rng):
    ratio, paid, m = p01.evaluate(x)
    margin = 1e4 * m * YEAR
    ff = p05.loss(w, prep)[2] * YEAR
    peak = p04.month(days)[2] - p04.month(1)[2]
    counted = ratio * (1 - caught)
    alert = caught * ratio * 0.9 * 144000 * 25
    need = sorted(p12.path(rng, k)[0] for _ in range(300))[296]
    return margin, ff, peak, alert, margin - ff - peak - alert, counted, need

if __name__ == "__main__":
    import random
    rng = random.Random(85)
    rows = {"A": ((1.0,) * 5, 0.35, 60.0, 7, 0.0, 1),
            "B": (p01.best(0.009), 0.711, 15.0, 1, 0.0, 1),
            "C": (p01.best(0.009), 0.711, 15.0, 1, 0.3, 3)}
    print("   setup  margin RM   friendly  season  alerts  net RM"
          "      ratio  cash RM")
    for name, args in rows.items():
        mg, ff, pk, al, net, r, need = setup(*args, rng)
        print("   {:<5} {:10,.0f}  {:8,.0f}  {:6,.0f}  {:6,.0f}  {:10,.0f}"
              "  {:5.2%}  {:9,.0f}".format(name, mg, ff, pk, al, net, r,
                                          need))
#    setup  margin RM   friendly  season  alerts  net RM      ratio  cash RM
#    A     18,567,559   432,000  10,298       0  18,125,260  0.94%  3,115,772
#    B     18,468,285    16,385       0       0  18,451,900  0.86%  3,175,855
#    C     18,468,285    16,385       0   8,331  18,443,569  0.60%  1,467,058

A 的毛利最高(RM 18,567,559),但友好欺诈损失 RM 432,000,旺季慢退款再多花 RM 10,298,净额 RM 18,125,260,卡通道比率 0.94%,需要现金储备 RM 3,115,772。B 的毛利略低(RM 18,468,285),友好欺诈损失只剩 RM 16,385,净额 RM 18,451,900,比率 0.86%。C 再付 RM 8,331 的预警费用,净额 RM 18,443,569,比率降到 0.60%,所需储备从三百多万降到 RM 1,467,058。从 B 到 C 几乎不花钱,却换来更低的比率与少一半以上的储备。

压力测试

对一家已经稳定经营、采用做法 C 的商户,测试四种情景所需的缓冲。

推导

# Chapter 8. p15: Stress tests for the cash buffer of an established
# business on setup C (three gateways, a 10% reserve already rolling, so
# releases match new holds). During a scenario of T days the daily drift
# of cash is
#   (share of payouts arriving * 0.97 * (1 - extra hold) - 0.75
#    - 0.03 * refund multiple) * V - mean shocks,
# and the buffer needed is the cash drained if the drift is negative,
# plus a 2.326-sd swing of the random shocks over T days, plus any lump.
#   S1 one of the three gateways freezes payouts for 180 days;
#   S2 a return season at five times normal refunds for 30 days;
#   S3 every gateway raises its hold from 10% to 30% for 180 days;
#   S4 S1, with S2's extra refunds (a lump) inside it.
from math import sqrt

V, PAY, COST, REF, MU, LAM = 40000.0, 0.97, 0.75, 0.03, 8000.0, 2 / 7

def need(share, hold, refund_x, T, lump=0.0):
    drift = (share * PAY * (1 - hold) - COST - REF * refund_x) * V \
        - LAM * MU
    swing = 2.326 * sqrt(T * LAM * 2 * MU ** 2)
    return drift, max(0.0, -drift) * T + swing + lump

if __name__ == "__main__":
    lump = 4 * REF * V * 30
    cases = (("S1 one gateway frozen 180 d", 2 / 3, 0.0, 1, 180, 0.0),
             ("S2 refunds x5 for 30 d", 1.0, 0.0, 5, 30, 0.0),
             ("S3 hold 30% for 180 d", 1.0, 0.2, 1, 180, 0.0),
             ("S4 = S1 with S2 inside", 2 / 3, 0.0, 1, 180, lump))
    print("   scenario                     daily drift RM  buffer RM")
    for name, share, hold, rx, T, lp in cases:
        d, u = need(share, hold, rx, T, lp)
        print("   {:<28} {:14,.0f}  {:9,.0f}".format(name, d, u))
#    scenario                     daily drift RM  buffer RM
#    S1 one gateway frozen 180 d          -7,619  1,560,148
#    S2 refunds x5 for 30 d                  514     77,044
#    S3 hold 30% for 180 d                -2,446    628,948
#    S4 = S1 with S2 inside               -7,619  1,704,148

三个网关之一冻结 180 天,每日现金漂移变为 RM -7,619,需要 RM 1,560,148;退款季五倍退款持续 30 天,漂移仍为正(RM 514),只需 RM 77,044 应付波动;所有网关把保证金从 10% 提高到 30%,持续 180 天,漂移 RM -2,446,需要 RM 628,948;网关冻结期间又遇退款季,需要 RM 1,704,148。最坏的情景不是退款,而是冻结。

注

四步核查。 第一,以 0.9% 为内部警戒线、0.65% 为缓冲(p01),在结账时按评分路由,不等上个月的比率 (Visa 2025)。第二,退款在 1 天内处理,并接入争议前预警服务。第三,每笔订单自动生成带哈希链的证据包,身份字段只保存带密钥的哈希,符合强有力证据 3.0 的匹配优先使用(p06) (Visa 2023)。第四,卡交易分散到至少三个通道,现金储备按第六章的公式定量级、按压力测试定金额,并承认「零破产」做不到。

预注册实验

推导

# Chapter 8. p16: Sample sizes for pre-registered tests (two-sided alpha
# 0.05, power 0.80). (1) Win rate of disputes fought with the basic
# package (order log + terms, 0.426) against the full package (0.711,
# p06): disputes per arm. (2) Share of refund requesters who dispute when
# refunds are paid within 1 day (0.091) against 7 days (0.377, p04):
# requesters per arm. (3) Card event ratio all on cards (0.94%) against
# the 0.90% routing (0.86%, p01): card sales per arm.
from math import ceil, sqrt

ZA, ZB = 1.96, 0.84

def n_per_arm(p1, p2):
    pb = (p1 + p2) / 2
    num = (ZA * sqrt(2 * pb * (1 - pb)) +
           ZB * sqrt(p1 * (1 - p1) + p2 * (1 - p2))) ** 2
    return ceil(num / (p1 - p2) ** 2)

if __name__ == "__main__":
    for label, a, b in (("(1) win rate 0.426 vs 0.711", 0.426, 0.711),
                        ("(2) dispute 0.091 vs 0.377", 0.091, 0.377),
                        ("(3) ratio 0.94% vs 0.86%", 0.0094, 0.0086)):
        print("   {:<28} {:>9,} per arm".format(label, n_per_arm(a, b)))
#    (1) win rate 0.426 vs 0.711         47 per arm
#    (2) dispute 0.091 vs 0.377          34 per arm
#    (3) ratio 0.94% vs 0.86%       218,515 per arm

检验完整证据包是否把胜诉率从 0.426 提高到 0.711,每组只需 47 笔争议;检验 1 天退款是否把申请退款者的争议率从 0.377 降到 0.091,每组只需 34 位申请者。检验路由是否把卡通道事件率从 0.94% 降到 0.86%,则每组需要 218,515 笔卡交易:这么小的比率差异,单店几乎无法用实验证明,只能依赖模型与长期记录。

假说 · 尚未验证

预注册的预测(尚未验证): 完整证据包使欺诈类争议的胜诉率至少提高 15 个百分点;1 天内退款使申请退款者的争议率至少降低一半。什么会证明它错: 胜诉率的提高显著小于 15 个百分点,或争议率的降低显著小于一半。

全书小结

0.9% 是已经退役的 VDMP 门槛,现行的 VAMP 在亚太以 1.5% 与 1,500 笔为界(p03),而且把欺诈报告与争议一起计算。按订单评分在结账时路由,可以用约 2% 的毛利压低卡通道比率;拒付会迟到,看上月比率再反应总是慢一拍。最便宜的控制是快速退款与争议前预警;证据包通过威慑减少虚假争议,但赢下的争议仍计入比率。现金储备买不到「零破产」,只能把破产概率压小;保证金高于净毛利率时会持续消耗现金,而最大的风险是网关冻结,分散通道比加大储备更有效。

参考文献

Visa. 2023. Visa Core Rules: Compelling Evidence 3.0 for Dispute Condition 10.4 (Other Fraud, Card-Absent Environment). Visa Inc.
Visa. 2025. Visa Acquirer Monitoring Program (VAMP): Program Overview and Merchant Thresholds. Visa Inc.

Fan, Y. (2026). Cross-Border Payment Routing, Chargeback Defense Games and Treasury Ruin Bounds: Multi-Acquirer Success Optimization, Dispute Evidence Scoring and Cramér-Lundberg Cash Reserves [跨境支付智能路由、拒付抗辩博弈与资金池破产边界] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090225 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).