Whenever you’re working with third-party APIs, and you’re doing so in an asynchronous nature, there is always the chance that whatever it is you’re requesting is going to return a un-desirable result.
Perhaps it’s an error code, perhaps it’s a warning, or maybe it’s a simple message saying something like “We’re still processing your request on our end.”
In each case, you can usually handle them on the server-side just fine and let the client-side know how to handle it. But if you’re dealing with the latter case, that is where you’re blocked by the third-party processing; there are other things you can do to handle this situation better.
For example, in the latter case, it’s better to wait for a little bit then make the request again to see if the API has a different response for you.
But when doing this, it requires Ajax which obviously requires JavaScript. One of the obvious, yet more dated methods of doing this is to use setInterval.
The problem with this, though, is that it creates a stack of requests and then, as the response is ready, each item in the stack will get the same response.
This can drastically impact any given server. And there are better ways to go about doing this.