Key points of this lesson, in order.
Routing and Retries
What you will learn
Your objective. By the end of this lesson, you will be able to explain routing and retries. Smart routing is the decision a gateway makes, in milliseconds, about which acquirer should handle a given transaction.
Why it matters. A gateway that offers only one acquirer cannot fail over, so multi acquirer support is a key question for a business analyst to ask during vendor evaluation.
Chapter objective: Learner explains payment gateway architecture, including checkout, token vault, routing, retries, and settlement, and designs a gateway flow for an online merchant. Learner practises this skill on realistic banking cases, explaining the reasoning clearly and using correct terminology throughout the work.
Key learning points
- Smart routing
- Failover: happens when chosen acquirer
- Retry strategies decide when to try again
- Circuit breakers protect the whole system
- Real outage shows why this
- Merchant with no failover
Key terms
Circuit breaker: A resilience pattern that stops calling a failing service after a set number of failures, giving it time to recover.
Idempotency: The property that repeating the same request has the same effect as sending it once. In payments, an idempotency key lets a client safely retry a request after a timeout without creating a duplicate...
Acquirer: A bank or licensed institution that processes card payments for merchants and receives transaction funds from card schemes on their behalf.
Banking architecture diagram showing Routing and Retries.
Practise this lesson
Exercise
Route the payment described in this lesson and justify the route.
Use the routing rules, the correspondent chain and the charges in this lesson.
- What to do. Name each bank in the chain, the message used on each leg, and the charges deducted at each step.
Correct result. The route follows the correspondent chain from the debtor agent to the creditor agent, with each intermediary deducting its charge and passing the remainder on. The message on each leg carries the information the next bank needs.
Why. Routing is a business decision with a cost. The wrong route is slower, more expensive, or fails.
Check your understanding
Practice question
Which of the following best describes routing and retries?
Takeaway and next step
What to remember
A gateway that offers only one acquirer cannot fail over, so multi acquirer support is a key question for a business analyst to ask during vendor evaluation.
Send a payment through the hub and watch it pass each component named in this lesson.
Open the Payment Hub Architecture Simulator →
Builds on "Gateway APIs".
Transcript and full text
Show transcript
Smart routing is the decision a gateway makes, in milliseconds, about which acquirer should handle a given transaction. The routing engine looks at the card type, the issuing bank, the transaction amount, the currency, the time of day and the recent approval rate for each acquirer. For example, a Visa credit card issued by Axis Bank for 12,000 rupees might route to Acquirer A, which approved 94 percent of similar Axis Bank transactions in the last hour, while a RuPay debit card for 450 rupees might route to Acquirer B, which charges a lower fee for small domestic debit payments. The goal is to maximize approvals and minimize cost at the same time, and the routing rules are tuned continuously from live performance data. Failover is what happens when the chosen acquirer does not respond. The gateway waits for a short timeout, often two to five seconds, and then sends the same authorization request to a backup acquirer. The customer sees only a slightly longer wait, not an error page, and the merchant avoids losing a sale because of a single bank outage. Failover works only when the merchant has more than one acquiring relationship, either directly or through the gateway, and when the backup acquirer supports the same card network and currency. A gateway that offers only one acquirer cannot fail over, so multi acquirer support is a key question for a business analyst to ask during vendor evaluation. Retry strategies decide when to try again, how many times, and with what delay. A retry makes sense for a temporary failure, such as a network timeout or a response code that means try again later, and it makes no sense for a hard decline, such as insufficient funds or a stolen card report. A common pattern is exponential backoff, where the first retry happens after one second, the second after two seconds, and the third after four seconds, with a maximum of three attempts. Each retry carries the same idempotency key, so a success on the second attempt does not create a duplicate charge. Retrying a hard decline wastes time, annoys the customer and can trigger fraud alerts, so the gateway must read the decline code before it decides. Circuit breakers protect the whole system when an acquirer is failing badly. A circuit breaker watches the error rate for each acquirer, and when failures pass a threshold, for example 50 percent of requests failing in five minutes, it opens the circuit and stops sending traffic to that acquirer for a cooling off period, often five to fifteen minutes. During that period, all traffic goes to healthy acquirers. After the cooling off period, the breaker allows a small number of test requests through, and if they succeed, it closes the circuit and restores normal routing. Without a circuit breaker, a gateway would keep hammering a dead acquirer, delaying every customer and filling logs with timeouts. A real outage shows why this matters. Suppose Acquirer A goes down at 7 in the evening during a festival sale, when a fashion merchant is processing 2,000 orders per hour. The gateway circuit breaker opens after 30 seconds of failures, and traffic shifts to Acquirer B within a minute. About 40 transactions fail during the switch, and the gateway retries the timeout cases automatically, so only 12 customers see an error and most of them succeed on a second attempt. The gateway dashboard records the incident, the number of transactions rerouted, and the approval rate by acquirer, so the merchant can claim service credits if the gateway contract includes an uptime guarantee. A merchant with no failover would have lost the full hour of sales instead.
Smart routing is the decision a gateway makes, in milliseconds, about which acquirer should handle a given transaction. The routing engine looks at the card type, the issuing bank, the transaction amount, the currency, the time of day and the recent approval rate for each acquirer. For example, a Visa credit card issued by Axis Bank for 12,000 rupees might route to Acquirer A, which approved 94 percent of similar Axis Bank transactions in the last hour, while a RuPay debit card for 450 rupees might route to Acquirer B, which charges a lower fee for small domestic debit payments. The goal is to maximize approvals and minimize cost at the same time, and the routing rules are tuned continuously from live performance data.
Failover is what happens when the chosen acquirer does not respond. The gateway waits for a short timeout, often two to five seconds, and then sends the same authorization request to a backup acquirer. The customer sees only a slightly longer wait, not an error page, and the merchant avoids losing a sale because of a single bank outage. Failover works only when the merchant has more than one acquiring relationship, either directly or through the gateway, and when the backup acquirer supports the same card network and currency. A gateway that offers only one acquirer cannot fail over, so multi acquirer support is a key question for a business analyst to ask during vendor evaluation.
Retry strategies decide when to try again, how many times, and with what delay. A retry makes sense for a temporary failure, such as a network timeout or a response code that means try again later, and it makes no sense for a hard decline, such as insufficient funds or a stolen card report. A common pattern is exponential backoff, where the first retry happens after one second, the second after two seconds, and the third after four seconds, with a maximum of three attempts. Each retry carries the same idempotency key, so a success on the second attempt does not create a duplicate charge. Retrying a hard decline wastes time, annoys the customer and can trigger fraud alerts, so the gateway must read the decline code before it decides.
Circuit breakers protect the whole system when an acquirer is failing badly. A circuit breaker watches the error rate for each acquirer, and when failures pass a threshold, for example 50 percent of requests failing in five minutes, it opens the circuit and stops sending traffic to that acquirer for a cooling off period, often five to fifteen minutes. During that period, all traffic goes to healthy acquirers. After the cooling off period, the breaker allows a small number of test requests through, and if they succeed, it closes the circuit and restores normal routing. Without a circuit breaker, a gateway would keep hammering a dead acquirer, delaying every customer and filling logs with timeouts.
A real outage shows why this matters. Suppose Acquirer A goes down at 7 in the evening during a festival sale, when a fashion merchant is processing 2,000 orders per hour. The gateway circuit breaker opens after 30 seconds of failures, and traffic shifts to Acquirer B within a minute. About 40 transactions fail during the switch, and the gateway retries the timeout cases automatically, so only 12 customers see an error and most of them succeed on a second attempt. The gateway dashboard records the incident, the number of transactions rerouted, and the approval rate by acquirer, so the merchant can claim service credits if the gateway contract includes an uptime guarantee. A merchant with no failover would have lost the full hour of sales instead.
Full lesson text (all scenes)
Completing a lesson updates your progress dashboard on the homepage.
Scene timestamps are estimated by allocating the narration text proportionally across the real audio length. The audio playback position is the source of truth: pause freezes the visual, seeking restores the correct scene, replay restarts the scene animation.