Sometimes, a payment that will fail on one gateway will go smoothly on another one. Maybe your main gateway is malfunctioning, or maybe that particular payment was declined on one gateway and wouldn’t have been rejected by another gateway.
In any case, that sale warrants another shot, right? It’s entirely possible that where you work, a retry is coded manually and can’t easily be changed.
Composer is Spreedly’s answer to that problem, giving your payments team the ability to make changes when it’s needed. Let’s take a look at the problems that come with just having a single gateway, and how Spreedly helps you solve it.
When the gateway says no
If you run almost all your volume through one gateway, an outage turns into a scramble. Someone has to spot it, open a ticket, and change the config to send traffic somewhere else. Until that happens, every checkout fails. Cold, harsh reality.
Then you’ve got soft declines. You’ll see a payment gets declined on one gateway when another one would have approved it, but you don’t have anything in place to make sure it gets approved. Some teams have built retry logic to catch these, but for the most part, it’s custom code that only a couple of engineers know how to change.
Know why homegrown retry breaks
One thing we all know about retry logic is that it can get stale faster than supermarket bread left on a counter. Every gateway words its decline codes differently, and those codes change over time.
So you end up with a hard-coded retry table that falls behind, and every new backup gateway has to wait for a release. A backup plan that lives in code is out of date the day it ships.
Retrying the wrong decline also costs you money. Visa forbids reattempts when the issuer will never approve, and it caps the rest under its resubmission rules. Mastercard charges fees on retries after certain merchant advice codes. To retry safely, you need a current map of which codes are retryable on which gateway.
No gateway can see past its own decline. The one that said no can't tell you another gateway would have approved the payment, and it has no way to move your traffic there.
Put failover on the canvas
In Composer, failover is a step on the canvas, and your payments team controls it. Each payment follows the same path:
- Composer sends the payment to your primary gateway.
- If that gateway is unreachable, Composer retries on a backup. Spreedly only retries after an outage when it knows the payment never reached the first gateway, so your customer isn't charged twice.
- If the gateway returns a soft decline, Spreedly checks the response against its error code mapping. A retryable code sends the payment to the backup, and a hard decline ends the attempt.
- If the first backup fails, the payment can try a second one. That gives you a primary plus up to two backups.
Your payments team picks the backup gateways, sets their order, and decides which declines get retried. They change those rules in the canvas without a deploy, and the backup can be any gateway on Spreedly's network of 150+ integrations.
Spreedly keeps the map of retryable codes current for 30+ primary gateways. If Spreedly hasn't mapped a code, the payment is treated as a hard decline and isn't retried.
Engineering only has to do setup once: gateway credentials, the Composer server SDK, and tokenization. After that, the payments team owns the rules.
Watch a failed payment recover
In the video below, a payment fails on the primary gateway and gets retried on a backup. The customer's checkout just shows "payment successful."
Reliable gateways still go down, and this is the plan for the day yours does. If you want help working out your own backup plan, talk to us. Failover is one of the steps you can build in Composer, next to your fraud and routing rules.
Will a customer be charged twice if a payment is retried?
No. After an outage, Spreedly only retries when it knows the payment never reached the first gateway.
Which declines get retried on a backup gateway?
Soft declines with codes Spreedly's error code mapping marks as retryable. Spreedly keeps that mapping current for 30+ primary gateways. Hard declines and codes Spreedly hasn't mapped are not retried.
Do we need a code deploy to change backup gateways?
No. Engineering sets up gateway credentials, the Composer server SDK and tokenization once. After that, the payments team picks the backup gateways (a primary plus up to two backups), sets their order and decides which declines get retried in the canvas.










