Build or adopt a payment router that receives a normalized charge request and selects a PSP based on configurable rules (cost, acceptance rate, currency, card network).
For each PSP, implement a normalized adapter that translates the common charge request into PSP-specific API calls and maps responses back to a common result schema.
On a soft decline or network timeout from the primary PSP, the router retries on a secondary PSP using a new idempotency key to avoid double charges.
Track per-PSP acceptance rates and error rates in a time-series store; feed this data back into routing weights so lower-performing PSPs receive less traffic automatically.
Implement a circuit breaker per PSP: after a configurable number of consecutive errors, stop routing to that PSP for a cool-down period.
Ensure your vault or tokenization layer can provide the raw PAN or a per-PSP network token so the fallback PSP can authorize the card.
Known gotchas
Failover only makes sense for soft declines (insufficient funds, do-not-honor) and network errors — hard declines (stolen card, invalid card number) will fail on any PSP and should not be retried.
If your primary PSP partially processes a charge before the timeout, a failover retry can cause a double charge; use idempotency keys and confirm settlement status before retrying.
Storing raw PANs to enable cross-PSP failover creates significant PCI scope; prefer a network tokenization vault or a PCI-compliant vault provider that can issue per-PSP tokens.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp