Working with cascades

Enable cascading

Cascading is enabled manually for your project. Contact Truegate technical support and ask us to enable cascading for the required project and its routes.

The route must have at least two card integrations with payment service providers (PSPs). Each integration has a weight used to select the provider. Weights can be different or equal.

How cascading works

Cascading automatically sends a payment to another card integration when the previous attempt receives a decline that allows a retry — a soft decline.

  1. When the payment starts, Truegate selects a matching route based on the country, currency, amount, and dynamic conditions, if configured.
  2. The first PSP is selected from the route's card integrations, by weight or by the route's order (see PSP selection).
  3. If the attempt receives a soft decline, that card integration is excluded from further selection.
  4. Truegate selects the next card integration from the remaining options in the same route, by weight or by the route's order, then automatically starts another attempt with the same card, amount, and currency.
  5. If that attempt also receives a soft decline, cascading can continue through the remaining integrations.
  6. Cascading stops after a successful payment or authorization, after a decline that does not allow cascading, or when no options remain.

Each configured card integration is used at most once within a payment session. Cascading uses the route's configuration saved when the payment started and does not switch to other routes in the project. A configuration change applies to payments started after it.

PSP selection

Each route has two settings that decide which card integration a card attempt goes to: one for the first attempt and one for the fallback attempts after a soft decline. Each setting is either by weight (the default) or by order, where the order is a list of the route's card integrations that you define.

First attemptFallback attemptsUse it for
By weightBy weightRandom distribution everywhere (default).
By orderBy orderA fixed chain with no randomness, for example Stripe → Ecommpay → Unlimit.
By orderBy weightOne PSP first, then a random split, for example Stripe first, then Ecommpay or Unlimit.
By weightBy orderA random first attempt, then a fixed chain.

Fixed order

With both settings by order, you list the route's card integrations in the order attempts should follow, for example Stripe → Ecommpay → Unlimit:

  • Every first attempt goes to Stripe. Weights are not used.
  • After a soft decline from Stripe, the next attempt goes to Ecommpay.
  • If Ecommpay also returns a soft decline, the next attempt goes to Unlimit.
  • If Unlimit also returns a soft decline, cascading stops because the order is exhausted.

If the first integration in the order cannot process the payment, the first attempt goes to the next one in the order.

One PSP first, then by weight

With the first attempt by order and the fallbacks by weight, the order holds a single integration that receives every first attempt. After a soft decline, the next attempt is selected at random among the route's other card integrations, according to their weights:

PSPWeightOrder
Stripe—1
Ecommpay50—
Unlimit50—

Every first attempt goes to Stripe. About half of the fallback attempts go to Ecommpay and half to Unlimit; if the second attempt also receives a soft decline, the remaining integration is tried. Each fallback integration needs a positive weight.

By weight first, then a fixed order

With the first attempt by weight and the fallbacks by order, the weights decide the first attempt and the order decides the fallbacks. An integration with weight 0 never receives first attempts while another integration has a positive weight, so it is used only as a fallback.

The fallbacks always start from the top of the order: with the order Stripe → Ecommpay → Unlimit, a payment whose first attempt went to Ecommpay continues with Stripe, then Unlimit. Integrations of the route that are not in the order are not used for fallback attempts.

Rules

Each integration in the order must be an active card integration of the same route, and appears once. With both settings by order, every card integration of the route must be in the order. Apple Pay, Google Pay, and other wallets are always selected by weight.

An integration that is the last one left in a route's order cannot be removed until the route's PSP selection is changed.

To change how a route selects PSPs, contact Truegate technical support with the route, the two settings, and the order you need.

How weights affect selection

This section describes the default selection, by weight for both settings. A PSP's weight determines its share in random selection. A higher weight means a larger share of initial payment attempts is sent to that PSP. Weights do not define a fixed order: the provider with the highest weight is not necessarily selected first, and the provider with the second-highest weight is not necessarily selected next.

For example, a route has three card integrations:

PSPWeight
A70
B20
C10

Across a large number of payments, the initial distribution will be approximately 70% / 20% / 10%. If A is selected first and returns a soft decline, the next attempt is selected between B and C according to their weights. If B is selected and also returns a soft decline, C is the remaining option. No further attempts are made after a successful attempt.

Declines that trigger cascading

Truegate maps decline reasons from different PSPs to a common set of codes. The following soft declines are used for cascading:

Truegate codeMeaning
AUTHENTICATION_FAILEDPayment authentication failed.
AUTHENTICATION_REQUIREDThe payment requires authentication.
GENERIC_DECLINEA general decline without a specific reason.
DO_NOT_HONORThe issuing bank declined the payment.
PROCESSING_ERRORAn error occurred while processing the payment.
ISSUER_UNAVAILABLEThe issuing bank is unavailable.
TRY_AGAIN_LATERA recommendation to retry later was received.

These are normalized Truegate codes; the original PSP codes and messages may differ.

Supported payments and results

Cascading is supported for one-off card payments and the first payment of a subscription. Cascading is currently not supported for recurring charges, payments using a saved payment method, or one-time payments within an existing subscription. Apple Pay, Google Pay, and other wallets do not participate in card cascading.

Retries start automatically within the same payment session. The customer does not need to re-enter their card details when switching to the next PSP, but the new PSP may require additional payment confirmation, such as 3-D Secure.

An intermediate decline followed by another cascading attempt is not sent to the merchant as a final failed result. The result is determined when the chain ends: a successful payment or authorization, or a failure if cascading cannot continue. In payment webhooks, the transactionId field retains the original payment session ID so you can match the result to the original payment. See the Webhooks guide for details on handling notifications.

Dynamic conditions

Dynamic conditions add routing criteria based on parameters your backend sends when starting a payment. For example, you can use different routes for different customer languages, marketing campaigns, or customer tiers.

Choose your own keys and use the same names in the admin panel and the API request. Truegate does not automatically determine values such as language, campaign, or tier.

1. Configure conditions in the admin panel

  1. Open Payment routing → your project → your route.
  2. In Dynamic conditions, click Add new condition.
  3. Enter a parameter name in Key, such as language.
  4. Click Add new value, enter es, and click Add. Repeat for other allowed values, such as en. Add each value separately.
  5. Add another condition if needed.
  6. Click Save changes to save the route settings.

For example, configure a route with these conditions:

KeyValues
languagees, en
tierpremium, platinum

2. Send the values from your backend

Include dynamicConditions in the JSON body of the request your backend sends to Truegate Public API to start the payment:

You do not need to pass this field to the frontend SDK. Truegate selects the route on its backend when processing the payment start request.

Add dynamicConditions as a top-level field alongside the other request parameters:

{
  "dynamicConditions": {
    "language": "es",
    "tier": "premium"
  }
}

This is a request body fragment. Keep the other required parameters described in the endpoint documentation. Send dynamicConditions separately from metadata, with one string value for each key.

3. How matching works

For the example above, the route requires:

Language is es OR en, AND customer tier is premium OR platinum.

  • Different keys use AND: every condition configured on the route must match.
  • Values within one key use OR: matching any one allowed value is sufficient.
  • If a required key is missing from the request or its value does not match, the route is excluded.
  • Extra request keys that are not configured on the route do not prevent a match.
  • Matching is exact and case-insensitive. Leading and trailing whitespace is removed. For example, " ES " matches es. Wildcards, regular expressions, and ranges are not supported.
  • The route must also satisfy the other selection criteria: payment country, currency, and amount limits.

Limits

SettingLimit
Conditions per route8
Values per condition16
Characters per key or value64
Keys in a payment start request16

Keys must be unique regardless of case. In the admin panel, use Latin letters, digits, and the separators _, -, and .. In keys, separators must appear one at a time between letters or digits, such as customer_tier or campaign-id.

Route selection

Among matching routes, Truegate considers routes with dynamic conditions before routes without them. If several matching routes have dynamic conditions, the route with the lowest ID is selected. If no dynamic route matches, generic routes keep their existing lowest-ID order. Requests without dynamicConditions therefore keep the same route selection as before. If no route matches, the payment start request fails.


Did this page help you?