Back to Blog
Integrations & systems

How to integrate an external service without letting its outages stop your app

An external provider's outage should not automatically become a product outage. Learn how to classify dependencies, set timeouts, retry safely, handle pending states, and test the experience when a provider fails.

Published 5 min read

A customer confirms a purchase in your app. The shipping-rate provider takes too long to respond, so the page keeps spinning. The order may have been recorded, but the customer cannot tell and clicks again. A straightforward API call has become an unclear experience and an operational problem.

Integrating an external service is not just about sending a request and reading its response. It also means deciding what your product does when the response is late, missing, or inconsistent with what the interface already shows. Those decisions need to remain clear to customers and staff when the provider is unavailable.

1. Map what actually depends on the provider

Walk through the core user journey and mark every point that calls an external service. For each call, ask: must it finish before the user can proceed? Could it complete later? Is there a safe alternative? Treating every dependency as equally urgent makes the whole product more fragile than it needs to be.

If an exact shipping rate determines the amount to charge, for instance, it would be misleading to confirm a made-up total when the provider is down. The app can preserve the cart and explain that the rate is not available yet. By contrast, sending an already confirmed order to an analytics tool can happen later without holding up the buyer's confirmation.

This exercise separates synchronous operations, which need an immediate answer, from asynchronous work that can remain pending. Decide which system owns each state as well. Your app should distinguish what it has confirmed itself from what it is still waiting for the provider to confirm. Sending a request is not, by itself, proof of success.

2. Put a boundary around waiting

Every external request needs an explicit timeout. Without one, a page or background worker can stay occupied while a provider takes too long. Choose the limit for the context: an on-screen action has a different tolerance from a background task. There is no universal setting; observe normal response times, decide how long users can reasonably wait, and test what happens beyond that point.

Distinguish a connection that cannot be established from a response that arrives too slowly. Both need a defined outcome: offer a way to return later, save the operation as pending, or explain that it cannot be completed yet. Check the total time across chained dependencies too. Several individually bounded calls can still make one user journey feel stuck.

The interface needs its own clear stopping point. When the server stops waiting, the screen should not keep displaying an indefinite spinner. Say what is known, what still needs confirmation, and what the user can do next.

3. Retry only when the operation is safe to repeat

A second attempt can resolve a temporary failure, but indiscriminate retries can make matters worse. Suppose a provider received a request to create an operation, but its reply was lost. Sending the request again might create a duplicate. Before retrying, determine whether the operation is idempotent: repeating it should have the same effect, not create another one.

Where the provider supports it, use a stable idempotency key for the same business operation. Keep that operation's identifier in your own system and check for an existing record before creating another. If a safe retry is not possible, check the provider's status or route the case for review rather than blindly resubmitting it.

Cap the number of attempts and space them out progressively so you do not overwhelm a struggling service. A transient network error may warrant a retry; a rejection caused by invalid data calls for a correction instead. If a provider is failing continuously, temporarily stopping calls to it can protect your app's resources. Make that behavior observable to the people running the product.

4. Make pending a real product state

Moving work into the background prevents a screen from blocking, but it does not remove the need to explain progress. Define useful states such as awaiting submission, submitted, confirmed, failed, and needs review. Specify which response triggers each transition and what happens when no response arrives.

A job queue can process pending work if the system retains enough information to resume it and prevents duplicate effects. If the provider sends later notifications, verify that each notification belongs to the expected operation before updating its state. Do not assume events will arrive exactly once or in the order you expect.

For users, distinguish “we received your request” from “the provider confirmed it.” If the status affects an important action, make it possible to check later and define a human review path for cases that remain unresolved. Give internal teams the failed step, the attempts made, and the available next action so they do not have to reconstruct an incident from scattered messages.

5. Test failure before release

An integration that works with successful responses is not yet production-ready. In a test environment, simulate slow replies, temporary errors, duplicate requests, malformed responses, and a full provider outage. Check both the technical result and the user experience: can someone proceed, do they receive accurate information, and does trying again produce a duplicate?

Test recovery as well. Leave several jobs pending, restore the connection, and confirm that they complete without changing operations that were already confirmed. Review access and data handling: protect credentials, avoid sensitive information in logs, and make alerts specific enough to be useful without generating unnecessary noise.

After launch, track how many operations remain pending, how long they take to resolve, and which ones need intervention. Start with one integration and one critical journey. Agree with product and operations on what status can be shown and who makes a decision when an exception occurs. That conversation often improves resilience more than adding retries without understanding the workflow.

If you are planning a critical integration, Cibercoding can help review the journey and define what should happen when the provider does not respond.

Topics

  • Integrations
  • App development
  • Software architecture
  • APIs
  • Resilience