PayFi Middle Layer: Engineering the “Spend” Path
Top-up & Settlement (sequence):
Top‑up → FX → Ledger → Auth → Capture → Anchor → Rewards (serialized)
Top‑up: User funds with MET/USDT → price source (multi‑exchange VWAP) sets base → create TopupIntent.
FX & net calc: Apply fees (FX/platform/fixed card fee) → compute NetUSD.
Double‑entry: Write into Ledger (T+0, idempotent), append audit log.
Authorization/Capture: Channel auth hold → capture.
Reconcile & anchor: Intraday reconciliation → batch Merkle root on‑chain (PaymentAnchored event) with proof fingerprints.
Rebates/rights: Generate rewards per merchant/quest rules (points/NFT/rebates) → write RewardLedger.
Three-phase risk:
Pre-event: region/device/account fingerprinting, MCC allowlist, per-tx/day limits (user + rail layers).
In-event: anomaly in frequency/amount, failure spikes, IP/device clustering → trigger KBA or temp freeze.
Post-event: chargeback/refund workflows, merchant dispute arbitration, list updates with explainable evidence.
Why on-chain anchoring:
Anchor Merkle roots (with stats: count, net amount, region, windowId) instead of sensitive detail. This enables non-repudiation without leaking PII/merchant info. For audit/disputes, recover proofs via Merkle paths.
Last updated