> ## Documentation Index
> Fetch the complete documentation index at: https://developers.pcibooking.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Fallback Payment Gateways

> Retry a declined charge automatically with other payment gateway accounts, in the order you choose.

A charge can fail at one payment gateway and still succeed at another, for example when one gateway has an outage or declines for a reason that is specific to that gateway. With fallback payment gateways, you list backup gateway accounts in the request. If the primary gateway does not complete the charge, PCI Booking tries the backups one by one until one succeeds.

Fallback is available in two places:

* The [Universal Payment Gateway](/api-reference/process-cards/process-transaction), in the `FallbackUpgs` field of a charge request.
* The [Payments Library](/api-reference/payments-library/create-session), in the `FallbackUpgs` field of the session.

Each fallback entry points to one of your [stored payment gateway credentials](/account-setup/gateway-credentials).

## How It Works

1. PCI Booking sends the charge to the primary gateway.
2. If the charge does not succeed, PCI Booking checks the decline reason (`RejectReasonCode`).
3. If the reason allows a retry, PCI Booking sends the charge to the first fallback gateway, then the next, in the order you listed them.
4. PCI Booking stops at the first gateway that succeeds and returns that result.

## When Fallback Is Not Used

A retry at another gateway cannot fix some declines, and repeating the charge could harm the cardholder or your merchant accounts. PCI Booking does not try any fallback gateway when the primary gateway declines with one of these [reject reason codes](/api-reference/process-cards/process-transaction#reject-reason-codes):

| `RejectReasonCode`  | Why no retry                                                                      |
| ------------------- | --------------------------------------------------------------------------------- |
| `CardExpired`       | The card cannot be charged anywhere.                                              |
| `Fraud`             | The transaction was flagged as fraudulent.                                        |
| `LostOrStolenCard`  | The card was reported lost or stolen.                                             |
| `InsufficientFunds` | Another gateway would reach the same account and be declined for the same reason. |

Fallback is used for any other failure, including declines with no reject reason code.

## Universal Payment Gateway and Payments Library Compared

|                                              | Universal Payment Gateway                             | Payments Library                                                                                 |
| -------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **Operations**                               | Charge only.                                          | The payment the session performs.                                                                |
| **Triggered by**                             | Any result other than `Success` or `Accepted`.        | A failed payment.                                                                                |
| **Fallback entry fields**                    | `PaymentGatewayAccountName`, `PaymentGatewayCertName` | `PaymentGatewayAccountId`, `PaymentGatewayCertName`, `PaymentGatewayParameters`, `Pass3DSData`   |
| **When the fallback accounts are checked**   | At payment time.                                      | When the session is created: the session is refused if an account or certificate does not exist. |
| **A fallback account that cannot be loaded** | Skipped; the next fallback is tried.                  | The payment fails.                                                                               |

In the Payments Library, fallback applies to card payments, Apple Pay and Google Pay, which are processed through a payment gateway. PayPal, BankPay and UPI payments do not use fallback gateways.

In the Payments Library, each fallback gateway can have its own gateway parameters and its own 3D Secure setting (`Pass3DSData`), because gateways differ in what they need.

## Related

* [Process Transaction API](/api-reference/process-cards/process-transaction): the `FallbackUpgs` field and the reject reason codes.
* [Create Session](/api-reference/payments-library/create-session): the `FallbackUpgs` field for Payments Library sessions.
* [Payment Gateway Credentials](/account-setup/gateway-credentials): store the accounts you use as fallbacks.
