Skip to content
Meem Payment

Payment failover best practices: when to try another provider, and when not to

Failure categories, unknown outcomes, idempotency, attempt caps and late successes: how to fail over without charging a customer twice.

RoutingReliabilityPublished: 7 min read
On this page

Failover sounds simple: if the first payment provider fails, send the payment to another one. In practice it is one of the easiest places in a payment stack to create real damage. Done carelessly, it double-charges customers, works around an issuer that has just said no, and turns a short incident into weeks of reconciliation.

This article sets out when moving a payment to another provider is safe, when it is not, and the controls that keep failover from making things worse.

Classify the failure first

The failover decision is really a classification problem. Before asking "where else can this go?", ask "what exactly happened?" A useful set of categories:

  • Technical failure before submission. The connection to the provider failed before the request was sent: DNS, TLS, connection refused. The provider never saw the payment.
  • Gateway unavailable. The account is marked unhealthy or its circuit breaker is open.
  • Rate limited. The provider rejected the request for volume reasons without processing it.
  • Not processed after timeout. The request timed out, and a follow-up status check confirms the provider has no record of processing it.
  • Soft decline. A temporary or route-specific decline. Some soft declines are eligible for another route; others are not.
  • Hard decline. The issuer refused, for example a stolen card, a closed account or an invalid card number.
  • Risk rejected. Your own rules, or the provider's fraud screening, blocked the payment.
  • Cancelled. The customer or merchant stopped the payment.
  • Technical failure after submission. Something broke after the provider received the request, so the payment may or may not have been processed.
  • Unknown. You cannot tell what happened.

Only the first group, plus a narrow set of soft declines, are candidates for failover. For more on how decline codes split into these groups, see soft vs hard declines.

Why some failures must never fail over

Hard declines are the issuer's decision about the card and the cardholder. A different acquirer reaches the same issuer, which will make the same decision. Repeated attempts can also look like card testing.

Risk rejections exist to stop a payment. Sending a payment that your risk rules blocked to a provider that does not apply those rules defeats the control.

Ineligible soft declines such as insufficient funds are temporary, but not in a way another provider can fix. The account still has no money. The right path is to tell the customer, not to try again elsewhere a few hundred milliseconds later.

Cancellations reflect someone's intent.

Technical failures after submission are the dangerous ones. If the provider received the request, it may have authorised the payment even though you never saw the response. Sending the same payment to a second provider can produce two authorisations for one order.

Handling unknown outcomes

Unknown outcomes need a process, not a guess:

  1. Query the provider. Use the provider's status or inquiry endpoint with the same payment reference. Many apparent timeouts resolve here, either as a clear success or a clear "not found".
  2. If it is still unclear, hold the payment as Unknown. Do not fail it over and do not report it to the customer as failed.
  3. Reconcile. Match the payment against provider reports and settlement files, then resolve it to its true state.

It is slower than failing over, and it is the only approach that cannot charge a customer twice.

Idempotency and double-charge risk

Idempotency protects you on two fronts. Between your systems and your orchestration layer, an idempotency key means a retried API call returns the original result instead of creating a second payment. Between the orchestration layer and each provider, a stable merchant reference lets you query status and lets the provider recognise duplicates where it supports that.

POST /api/v1/payments
Idempotency-Key: order-10482-attempt-1
Content-Type: application/json

Rules worth enforcing: the same key with a different body should be rejected, not silently accepted, and a request arriving while the first one is still in flight should get a conflict response rather than starting a parallel payment. On the merchant side, record a unique claim per order so that the order can be marked paid only once, whatever happens upstream. The payments API guide shows how this works in practice.

Bounding failover

Limits on attempts, time and scope

Even safe failover needs bounds:

  • Maximum attempts. Two or three providers is usually the most a customer should wait through. A hard platform cap protects against misconfiguration.
  • Time budget. The total time across attempts, not per attempt. A customer at a checkout page will not wait indefinitely.
  • Retry delay. Short pauses can help with rate limiting.
  • Provider scope. Decide which accounts are allowed as fallbacks. A fallback that does not support the card scheme, currency or 3DS flow will just fail differently.

Health checks and circuit breakers

Most good failover happens before a request is sent. A health monitor that probes each account on an interval, with hysteresis so one blip does not flip the state, and a circuit breaker that stops sending traffic to an account that is failing in production, together remove a struggling provider from the route before customers hit it. That turns many "failovers" into plain routing decisions, which is safer. How health feeds eligibility is covered in how intelligent routing works.

Late successes and reversals

Sometimes the first provider reports success after you have already moved on, for example in a webhook that arrives after a timeout was classified and a second attempt succeeded. Now the customer has two authorisations or captures for one order.

The safe response is to detect it, alert loudly, and create a reversal task that a person approves, typically a void or refund of the duplicate. A wrong automatic reversal moves money in the wrong direction with no human in the loop, so nothing should be reversed automatically.

Test failover before it matters

Failover logic runs rarely in production, which is why it breaks. Test it deliberately:

  • Simulate each failure category against your workflow and confirm which ones fail over and which stop.
  • Check edge cases: the last provider in the list, an unhealthy fallback, a scheme only one account supports.
  • Use sandbox providers or mocks to inject timeouts, rate limits and late webhooks.
  • Rehearse the unknown-outcome and late-success paths, including who receives the alert and who approves the reversal.

The routing simulator lets you explore routing and failover paths on synthetic data.

How Meem approaches this

In Meem Routing, the failover policy lives on the workflow's Start node and works with ten failure categories. Five are configurable: technical-before-submission, gateway unavailable, rate limited, not-processed-after-timeout and eligible soft decline. Five never fail over: hard decline, risk rejected, cancelled, ineligible soft decline (such as insufficient funds) and technical-after-submission. Unknown outcomes are queried with the PSP first; if still unknown, the payment is held as Unknown for reconciliation and never failed over. Limits cover maximum attempts (with a platform cap of 3), a time budget, retry delay and provider scope.

Attempt states are durable. A late success raises a critical alert and an approval-gated reversal task; nothing is reversed automatically. The payments API supports Idempotency-Key, returning the original response on replay, 409 while the first request is in flight, and 422 when a key is reused with a different body. Simulation shows the failover plan without creating payments.

Failover is separate from Meem Recovery. Recovery applies after a conclusive decline in hosted checkout, and the customer chooses another card or eligible method; there is no automatic retry of the customer's payment. To walk through your own failure scenarios, book a demo.

Related articles

See Meem orchestrate your payments

Walk through Routing Studio, recovery and intelligence with our team, using your providers, methods and markets.