Audience: Security, Admins, Developers, Support, SRE
Outcomes: Tight security posture; fast troubleshooting; handy endpoint list
Security hardening
Rotate API keys and webhook secrets regularly
Restrict CORS to trusted frontend origins
CSP: allow required Stripe domains; block inline scripts
Never log PANs or raw webhook payloads containing secrets
Encrypt at rest; restrict who can view invoices with PII
Least privilege on provider dashboards & internal roles
Common errors & fixes
Card declined (generic) → Ask user to contact issuer or try another card; log
stripe_code
Requires authentication → Show 3DS modal; allow retry if closed
Webhook signature invalid → Ensure
express.raw()
+ correct secret; rotate if leakedPending forever → Replay webhook; check handler errors
Bank payment not found → Settlement delay; confirm reference; widen date window
SSE not updating → Fix CORS/credentials; ensure
withCredentials:true
Operational runbooks (incidents & escalations)
Stripe webhook outage: show status banner; switch to manual reconciliation; after recovery, replay webhooks; verify idempotency
Bank provider delays: communicate ETA; increase webhook retry window; extend deposit deadlines; post manual journal entries with later reversal
Duplicate releases: freeze further releases; validate idempotency keys & recent event IDs; reconcile balances; issue adjustments/refunds if needed
Escalation ladder:
P1: money lost/wrong recipient → on-call engineer + finance lead + exec
P2: delayed confirmations → SRE + support
Payments API — quick reference
Card (Stripe)
POST /api/payments/intents POST /api/payments/stripe/checkout-session POST /api/webhooks/stripe
Bank (open banking)
POST /api/payments/bank/link POST /api/webhooks/bank
Crypto / Escrow
POST /api/escrow/deploy-contract POST /api/escrow/monitor-deployment POST /api/escrow/release
Invoices
GET /api/invoices/:orderId.pdf
Errors & idempotency
401
Unauthorized,403
Forbidden (role/KYC),404
Not found,400
Validation,500
InternalSend a stable reference for create/confirm/release; webhooks processed once via event ID dedupe