A Lagos-based payments startup processing ₦2.5 billion monthly in B2B invoicing integrated with a Tier-1 bank's API last year. Within the first month, they discovered that roughly 3% of their transactions were timing out during peak hours—not failing with an error code, but simply vanishing into the network. The bank's infrastructure, shared across thousands of merchants, struggled during business hours between 10 AM and noon.
Without proper retry logic, these transactions appeared abandoned to the merchant's customers. Invoices went unpaid. Disputes escalated. The company only realized the problem when their bank liaison flagged unusual chargeback patterns. The actual failure rate was recoverable: 94% of those transactions would have succeeded with a single intelligent retry.
This scenario repeats across Nigeria's payments ecosystem. NIBSS-connected banks experience latency spikes, timeouts, and temporary unavailability, particularly around month-end and during regulatory reporting windows. Building retry logic isn't optional—it's the difference between a reliable payment system and one that hemorrhages legitimate transactions.
Nigerian bank APIs fail in distinct ways. A timeout after 15 seconds doesn't mean the transaction failed—the bank's server may still be processing it. A 500 error during a retry might be transient network congestion, not a permanent rejection. An HTTP 503 (Service Unavailable) often signals scheduled maintenance windows that banks announce via CBN circulars but don't always coordinate across all merchant channels.
Different banks have different retry windows. Some banks process INSTANT transfers (INSTCs) on NIBSS and expect resolution within 30 seconds; others queue transactions and settle in batches. A retry too aggressive will trigger duplicate-payment detection on the bank's side. A retry too timid will lose transactions that would have succeeded.
Key failure categories you'll encounter:
Transient failures (80–90% of cases): Network timeouts, temporary gateway unavailability, brief load spikes. These respond well to exponential backoff.
Idempotency failures: The bank processes your payment twice because your system retried. This requires idempotency keys (unique reference IDs) on every request.
Regulatory holds: CBN-mandated sanction checks or fraud reviews temporarily suspend processing. Retries won't help for 10+ minutes; you need monitoring alerts instead.
Network routing issues: Payments routed through GTB, UBA, or other NIBSS node operators may experience path-specific latency. Some merchants report better results retrying via alternative payment gateways (Flutterwave, Paystack, Interswitch).
The naive retry approach—retry immediately, then every 5 seconds—fails in production. When a bank's API goes down, every client retrying simultaneously floods it with requests, delaying recovery. This is called the thundering herd problem.
Exponential backoff spreads retries over time:
Attempt 1: Immediate (0 seconds) Attempt 2: 1 second + random jitter (0–1 second) Attempt 3: 2 seconds + jitter Attempt 4: 4 seconds + jitter Attempt 5: 8 seconds + jitter Attempt 6: 16 seconds + jitter (stop here for INSTCs)
For Nigerian bank APIs, we recommend capping the backoff at 16 seconds for INSTANT transfers (regulated to settle within 30 seconds) and 120 seconds for regular transfers. Jitter is critical—add a random 0–1000ms offset to each wait to prevent synchronized retries across your user base.
Code structure (pseudocode):
max_retries = 5 base_delay = 1 (seconds)
for attempt in 1..max_retries: try: result = call_bank_api(payment) if result.success: return result catch timeout_or_5xx_error: if attempt < max_retries: delay = base_delay ^ attempt + random(0, 1000) / 1000 wait(delay) else: log_permanent_failure(payment) return error
This pattern dramatically reduces unnecessary API calls during incidents while ensuring you attempt recovery without abandoning transactions prematurely.
Every transaction you send to a bank API must carry a unique idempotency key—typically a UUID or hash of the transaction details. If your client retries a payment (or your server crashes and reprocesses the queue), the bank receives the same key twice and returns the original result instead of charging twice.
Nigerian banks handle idempotency differently. Some (GTBank, UBA via their newer APIs) accept X-Idempotency-Key headers. Others require you to pass an internal Reference ID field. A few older banking APIs don't support idempotency at all, requiring you to query their settlement status before retrying.
Best practice:
1. Generate idempotency_key = UUID() when the user initiates payment 2. Store (idempotency_key, amount, destination_account, status) in your database before the first API call 3. Include idempotency_key in every request to the bank 4. If a retry succeeds, query the bank to confirm it's the same transaction (not a duplicate) 5. If the bank reports duplicate key, fetch the original result and reconcile locally
This prevents the scenario where a customer's ₦500,000 transfer succeeds but times out, gets retried, and hits their account twice. Regulatory bodies (NDRC, CBN) take duplicate-charge complaints seriously; proper idempotency is non-negotiable.
Retry logic running invisibly in the background is dangerous. You need observability—the ability to see what's actually happening.
Log every retry attempt with context: - Transaction ID - Attempt number - Time of attempt - Response code and message - Retry delay applied - Cumulative latency
Alerts should trigger when: - Retry rate exceeds 5% for a given bank API (signals outage) - A single transaction exhausts all retries (permanent failure, needs manual review) - Median response time crosses 10 seconds (early warning of congestion) - Specific error codes appear (e.g., CBN sanction-check hold, which requires escalation to compliance)
For Nigerian compliance, maintain audit trails for at least 6 months (CBN requirement). Document why a payment failed permanently—was it insufficient funds, invalid account, or system timeout? This distinction matters for customer service and regulatory inquiries.
A practical setup: use CloudWatch (AWS), Datadog, or New Relic to track retry metrics. Set up dashboards showing success rate, retry rate, and latency percentiles broken down by bank. Monthly reviews should identify patterns (e.g., Zenith Bank frequently timing out on Wednesdays) to guide escalations with bank partners.
Real-world integration surfaces quirks that generic documentation misses. A few common ones in Nigeria's banking network:
Month-end processing delays: Between the 27th and 3rd of the following month, many banks perform settlement and reconciliation. Transaction latency increases 3–5x. Adjust your timeout thresholds during these windows, or risk unnecessary retries.
INSTC vs. non-INSTANT transfers: INSTANT transfers (via NIBSS INSTANT channel) must settle within 30 seconds or are considered failed. Standard transfers can take 24 hours. Your retry logic must distinguish between these; retrying an INSTANT after 35 seconds is pointless.
Direct bank APIs vs. NIBSS: Some institutions (Zenith, Access, Wema) offer proprietary APIs for intra-bank transfers that bypass NIBSS entirely. These have different timeout windows and retry policies. Verify with each bank partner.
Sanction-check holds: CBN and NDPC mandate screening against sanctions lists. If a transaction hits a hold for manual review, the bank returns a specific code. Retrying won't help; you need to escalate to your bank liaison or display a message to the user.
Test these scenarios with your bank partner's sandbox before deploying. Many banks provide sandbox environments where you can simulate failures, but you must explicitly ask and document the behavior of each retry scenario.
As transaction volume scales from thousands to millions monthly, retry logic becomes infrastructure-critical. A few architectural patterns that work well in Nigeria:
Asynchronous queue-based retries: Instead of retrying in-process, push failed transactions to a retry queue (Redis, RabbitMQ, AWS SQS). A separate worker service processes retries on a schedule. This decouples retry logic from your main API, preventing cascading failures.
Circuit breaker pattern: If a bank API fails 10 times in succession, stop sending requests for 2 minutes. This prevents hammering an outaged service. Once the circuit reopens, resume with reduced request volume.
Database-backed state: Store every transaction's state (pending, succeeded, failed, retrying) in your database. Query this before retrying to avoid duplicate attempts from concurrent requests.
Differential retry by bank: Not all banks need the same retry policy. Configure retry behavior per bank in a config file or database table. GTBank might tolerate 6 retries; Zenith might only accept 3 before flagging as fraud.
Regional failover: If a single bank's API is consistently down, consider routing through alternative channels. Flutterwave or Paystack aggregate multiple bank APIs; routing through them during bank-specific outages reduces dependency on a single connection point. However, this adds fees, so decisions should be based on cost-benefit during incident reviews.
KorabTech has architected payment systems handling 2+ billion transactions annually across multiple West African banks. Our approach combines robust retry logic, real-time monitoring, and automated incident escalation to keep payment flows working during the inevitable network hiccups that characterize Nigeria's financial infrastructure. If your organization is processing significant payment volumes and concerned about silent failures, we can help design and implement a system tailored to your transaction patterns and bank partnerships.
Why work with KorabTech? We're a Lagos-based team that builds and ships real, production systems for Nigerian and West African businesses — not pilots, not proof-of-concepts. If what you just read sounds like a problem your business is facing, we'd genuinely like to talk it through with you.